The plaintiff, to recover, must prove: (1) his subcontract; (2) work done and labor performed in fulfillment thereof; (3) a balance due; (4) notice to the owner as required by statute prior to payment of the contract price to the principal contractor; and (5) a balance due the contractor. C. S., 2437; C. S., 2439-40. Upon such showing the law requires the owner to apply the unexpended contract price due the contractor to the payment of amounts due subcontractors and materialmen of whose claims the owner has received notice. C. S., 2439-40-41; pro rata if necessary. C. S., 2442; Construction Co. v. Winston-Salem Journal, 198 N. C., 273, 151 S. E., 631; Brown v. Ward, 221 N. C., 344; Powder Co. v. Denton, 176 N. C., 426, 97 S. E., 372; Foundry Co. v. Aluminum Co., 172 N. C., 704, 90 S. E., 923; Supply Co. v. Eastern Star Home, 163 N. C., 513, 79 S. E., 964; Clark v. Edwards, 119 N. C., 115; Mfg. Co. v. Holladay, 178 N. C., 417, 100 S. E., 597.
The claim of the subcontractor or materialman supplants that of the contractor and the duty of the owner to pay is an independent, and primary obligation created by statute. The owner is liable to the subcontractor, however, only in the event he received notice of claim prior to settlement with the principal contractor and then only to the extent of the unexpended contract price still retained by him. Price v. Gas Co., 207 N. C., 796, 178 S. E., 567.
The plaintiff has alleged that Blackwelder was the contractor under whom he worked. He must stand or fall on this allegation. Whichard v. Lipe, 221 N. C., 53. Hence, he is not affected by any controversy between defendants and Fisher. But, conceding the identity of the contractor, the same conclusion follows. . The cross action defendants seek to set up against Fisher is not germane to, founded upon or necessarily connected with the subject matter in litigation between plaintiff and defendants. Decision on the issues thus attempted to be raised is not essential to a full and complete determination of the cause of action *230alleged by plaintiff. It should not be engrafted upon Ms action and thus compel him to stand by while defendants and Fisher litigate their differences in his suit. Montgomery v. Blades, 217 N. C., 654, 9 S. E. (2d), 397, and cases cited; Wingler v. Miller, 221 N. C., 137; Burleson v. Burlesgn, 217 N. C., 336, 7 S. E. (2d), 706; Beam v. Wright, ante, 174.
The cross action by a defendant against a codefendant or a third party permitted under our practice must be in reference to the claim made by the plaintiff and based upon an adjustment of that claim. Independent and irrelevant causes of action cannot be litigated by cross action. Coulter v. Wilson, 171 N. C., 537, 88 S. E., 857; Montgomery v. Blades, supra; Wingler v. Miller, supra; Beam v. Wright, supra.
Questions in dispute among the defendants may not he litigated by cross action unless they arise out of the subject of the action as set out in the complaint and have such relation to the plaintiff’s claim as that their adjustment is necessary to a full and final determination of the cause. Hulbert v. Douglas, 94 N. C., 128; Montgomery v. Blades, supra; Wingler v. Miller, supra; Beam v. Wright, supra.
The presence of Fisher as a party is not essential to enable defendants to fully resist the claim of plaintiff. The defenses of “settlement with the contractor” and of “no debt due the contractor at the time of notice” are available to defendants on the pleadings as presently filed without the joinder of the contractor as a party defendant.
It is to be noted that the judgment entered sustains the demurrer but does not dismiss the action as to Fisher. The cross action is out but Fisher is not. He may defend on the issue as to the amount due by the owner to the contractor. Waiving the controversy as to who was the contractor, he is, perhaps, on this issue, a proper, though not a necessary, party.
We concur in the conclusion of the court below. There is a mis-joinder both of parties and of causes óf action. Shore v. Holt, 185 N. C., 312, 117 S. E., 165; Bank v. Angelo, 193 N. C., 576, 137 S. E., 705; Rose v. Warehouse Co., 182 N. C., 107, 108 S. E., 389; Taylor v. Ins. Co., 182 N. C., 120, 108 S. E., 502; Roberts v. Mfg. Co., 181 N. C., 204, 106 S. E., 654; Montgomery v. Blades, supra; Wingler v. Miller, supra; Beam v. Wright, supra.
The plaintiff does not allege that at the time he filed statutory notice of his claim with the defendants they were then indebted to the contractor. Whether this is essential we need not now decide. If plaintiff deems it advisable to amend he may still seek permission to do so.
The judgment below is
Affirmed.