The question presented by this appeal is whether the counterclaim is permissible under G.S. 1-137, pertinent provisions of which are as follows:
“The counterclaim mentioned in this article must be one existing in favor of a defendant and against a plaintiff between whom a several judgment might be had in the action, and arising out of one of the following causes of action:
1. A cause of action arising out of the contract or transaction set forth in the complaint as the foundation of the plaintiff’s claim, or connected with the subject of the action.
* *
If the counterclaim is permissible in this action, it is because it is connected with the subject of the action set forth in the complaint. “The ‘subject of the action’ means, in this connection, the thing in respect to which the plaintiff’s right of action is asserted, whether it be specific property, a contract, a threatened or violated right, or other thing concerning which an action may be brought and litigation had.” To be connected with the subject of action “the connection of the case asserted in the counterclaim and the subject of the action must be immediate and direct, and presumably contemplated by the parties.” Hancammon v. Carr, 229 N.C. 52, 47 S.E. 2d 614. The construction of the phrase “subject of the action” set out in the Hancammon case has been relied upon in numerous subsequent cases. Insurance Co. v. Falconer, 272 N.C. 702, 158 S.E. 2d 793; Amusement Co. v. Tarkington, 247 N.C. 444, 101 S.E. 2d 398; Etheridge v. Wescott, 244 N.C. 637, 94 S.E. 2d 846; Bizzell v. Bizzell, 237 N.C. 535, 75 S.E. 2d 536; Garrett v. Rose, 236 N.C. 299, 72 S.E. 2d 843.
In this case, plaintiff seeks to remove a cloud from her title. Defendants admit the title of plaintiff subject to defendants’ rights as assignees of four deeds of trust and liens for taxes paid, etc. Defendants contend that they are owners of liens on the property and are entitled to have the deeds of trust foreclosed and their liens satisfied. The subject of the action appears to be plaintiff’s rights in the property, and assuming the truth of defendants’ allegations, plaintiff’s title remains clouded.
It is well settled in this jurisdiction that the holder of a note secured by a deed of trust may sue the makers in personam for the debt and may sue in rem to subject the mortgaged property to the payment of the note, and may combine the' two remedies in one *290civil action, G.S. 1-123, but in the action for foreclosure the trustee in the deed of trust is a necessary and indispensable party. Underwood v. Otwell, 269 N.C. 571, 153 S.E. 2d 40.
As stated in an earlier case with regard to G.S. 1-123, “[t]his section has been liberally construed to the end that justiciable controversies may be expeditiously adjusted by judicial decree at a minimum of cost to the litigants and the public.” Pressley v. Tea Co., 226 N.C. 518, 39 S.E. 2d 382. The Pressley case arose under G.S. 1-123, but the purposes of G.S. 1-123 and G.S. 1-137 are the same. Hancammon v. Carr, supra. Current legislative intent is indicated by G.S. 1A-1, Rule 13.
We hold that the trial court erred in sustaining plaintiff’s demurrer to defendants’ cross-action and entering judgment terminating the action. The judgment is vacated and this cause is remanded for further proceedings consistent with this opinion.
Error and remanded.
Mallard, C.J., and Parker, J., concur.