
183 S.E.2d 834 (1971)
12 N.C. App. 448
CROSROL CARDING DEVELOPMENTS, INC.
v.
GUNTER & COOKE, INC.
No. 7114SC655.
Court of Appeals of North Carolina.
October 20, 1971.
*836 Smith, Moore, Smith, Schell & Hunter by Beverly C. Moore and Michael R. Abel, Greensboro, and White & Coch, New York City, for plaintiff appellant-appellee.
Nye & Mitchell by John E. Bugg, Durham, and Richards & Shefte, Channing L. Richards, Charlotte, for defendant appellant-appellee.
GRAHAM, Judge.

PLAINTIFF'S APPEAL
Plaintiff contends the court erred in holding that Carding Canada is a party which must be joined under Rule 19 and in ordering plaintiff's action dismissed with prejudice if Carding Canada is not joined within forty days from the date of the order.
Rule 19(a) of the North Carolina Rules of Civil Procedure provides, "[s]ubject to the provisions of Rule 23 [Rule 23 relates *837 to class actions], those who are united in interest must be joined as plaintiffs or defendants. * * *"
Section (b) of Rule 19 provides: "The court may determine any claim before it when it can do so without prejudice to the rights of any party or to the rights of others not before the court; but when a complete determination of such claim cannot be made without the presence of other parties, the court shall order such other parties summoned to appear in the action."
These provisions make no substantive change in the rules relating to joinder of parties as formerly set out in G.S. § 1-70 and G.S. § 1-73. Both G.S. § 1-70 and G.S. § 1-73 were repealed by Session Laws 1967, c. 954, § 4, effective 1 January 1970. "The new rules of civil procedure make no change in either the categorizing of parties as necessary, proper and formal, or in the underlying principles upon which the categories have been based." 1 McIntosh, N.C. Practice and Procedure 2d, § 585 (Supp.1970).
Necessary parties must be joined in an action. Proper parties may be joined. Whether proper parties will be ordered joined rests within the sound discretion of the trial court. Strickland v. Hughes, 273 N.C. 481, 160 S.E.2d 313. A necessary party is one who is so vitally interested in the controversy that a valid judgment cannot be rendered in the action completely and finally determining the controversy without his presence. Strickland v. Hughes, supra. A proper party is one whose interest may be affected by a decree, but whose presence is not essential in order for the court to adjudicate the rights of others. Simon v. Raleigh City Board of Education, 258 N.C. 381, 128 S.E.2d 785.
Defendant alleges in its motion that a complete determination of plaintiff's alleged claim cannot be made unless Carding Canada is made a party, because without Carding Canada's presence, "defendant will be precluded from attacking in its further answer and defense the validity of the underlying patent." Defendant has filed no pleadings and the question of whether the invalidity of the patent which defendant agreed to pay damages for infringing can be pleaded as a defense in this action is not before us. Suffice it to say, however, any defense which would relieve defendant of liability under the contract may be asserted in any action brought for its breach, irrespective of whether all of the parties to the contract are present.
We do not view Carding Canada as a necessary party. Plaintiff, although a formal party to the agreement, is in effect a third party beneficiary. A party to a contract is ordinarily not a necessary party in a suit brought against the other contracting party by a beneficiary who claims the contract has been breached. Pickelsimer v. Pickelsimer, 255 N.C. 408, 121 S.E.2d 586. It does not follow, however, that the court committed reversible error in ordering the joinder of Carding Canada as a party, for if it is a proper party, plaintiff may not complain of its joinder. Simon v. Raleigh City Board of Education, supra.
Paragraph 3 of the agreement sued upon provides that when a company other than Carding Canada purchases equipment from defendant, the purchasing company must pay or credit Carding Canada an amount equal to the purchase price. While this is a matter primarily between Carding Canada and plaintiff, it nevertheless represents an interest which Carding Canada has in this litigation. Furthermore, under the terms of paragraph 3 of the agreement the purchase price of any equipment purchased by plaintiff from defendant must be set off and applied against the balance which defendant owes Carding Canada. It follows that any amount recovered by plaintiff in this suit would likewise constitute a set off against Carding Canada's claim under the contract. Therefore, Carding Canada most assuredly has interests in this controversy, although its interests are not of such a nature as to render it impossible for the court *838 to finally adjudicate the question of defendant's liability to plaintiff without Carding Canada's presence.
We hold that Carding Canada is a proper party to the lawsuit. Consequently, the question is whether the trial court abused its discretion in ordering Carding Canada joined as a party. "When not regulated by statute the procedural processes which will best promote the administration of justice are left to the judicial discretion of the trial judge. He has plenary power with respect to those who ought to be made parties to facilitate the administration of justice." Overton v. Tarkington, 249 N.C. 340, 345, 106 S.E.2d 717, 721. The addition of Carding Canada as a party will undoubtedly facilitate an early disposition of various questions which may arise as to defendant's remaining obligation to Carding Canada under the agreement and Carding Canada's rights to any proceeds recovered by plaintiff. The trial judge exercised sound discretion in ordering Carding Canada made a party.
The court's order is erroneous, however, insofar as it purports to dismiss plaintiff's action with prejudice in the event Carding Canada is not made a party within forty days from the date of the order. Dismissal is appropriate where, as here, the party ordered joined is not subject to the court's jurisdiction. G.S. § 1A-1, Rule 12(b) (7). However, dismissal for failure to join a necessary party is not a dismissal on the merits and may not be with prejudice. G.S. § 1A-1, Rule 41(b). The same is true, of course, where the party ordered joined is not a necessary party but is a proper party which the court, in its discretion, decides should be joined. The following language relating to Rule 12(b) (7) of the Federal Rules of Civil Procedure is applicable also to our Rule 12(b) (7):
"When faced with a motion under Rule 12(b) (7), the court will decide if the absent party should be joined as a party. If it decides in the affirmative, the court will order him brought into the action. However, if the absentee cannot be joined, the court must then determine, by balancing the guiding factors set forth in Rule 19(b), whether to proceed without him or to dismiss the action. * * A dismissal under Rule 12(b) (7) is not considered to be on the merits and is without prejudice." 5 Wright & Miller, Federal Practice and Procedure, § 1359, pp. 628, 631.
The court order is modified by striking therefrom the words "with prejudice." The order as modified is affirmed. Unless Carding Canada is made a party to this action within forty days from the date this opinion affirming the order is certified to the Clerk of Superior Court of Durham County the action will be dismissed.

DEFENDANT'S APPEAL
Defendant appeals from the denial of its motion to dismiss the action on the grounds plaintiff is not the real party in interest. G.S. § 1A-1, Rule 17(a) provides:
"Every claim shall be prosecuted in the name of the real party in interest; but * * * a party with whom or in whose name a contract has been made for the benefit of another, * * * may sue in his own name without joining with him the party for whose benefit the action is brought. * * *"
This rule is identical to Rule 17(a) of the Federal Rules of Civil Procedure. In 3A Moore's Federal Practice, § 17.13(1), pp. 502, 503, it is stated: "Whether a third party beneficiary has a right of action depends upon the substantive law. The result is that if by the substantive law the beneficiary has a right of action, the effect of the inclusion of this clause is that the beneficiary may sue, and the party with whom or in whose name the contract was made may also sue and need not join the beneficiary."
In the Comment of the General Statutes Commission appearing in Annotations to G.S. § 1A-1, Rule 17, we find:
"Furthermore, the third-party contract beneficiary has well established substantive *839 rights which he should be allowed to sue for in his own name, notwithstanding the contract parties alone are `real' parties to the contract and hence, possibly, to the rights arising under it."
It is well established in this jurisdiction that a third party beneficiary to a contract is entitled to maintain an action for its breach. 2 Strong, N.C.Index 2d, Contracts, § 14, p. 318. This rule is not applicable, however, where the contract is not made for the direct benefit of the third party and any benefit accruing to him is merely incidental. Vogel v. Reed Supply Co. v. Developers, Inc., 277 N.C. 119, 177 S.E.2d 273; American Trust Co. v. Catawba Sales & Processing Co., 242 N.C. 370, 88 S.E.2d 233.
Defendant says that at most plaintiff has only incidental rights under the agreement in question. We disagree. Not only does plaintiff have the right to purchase specifically described equipment from defendant, but it also has the right to make such purchases at specified discount prices. The agreement does not purport to give plaintiff the right to make purchases of equipment simply as the agent of Carding Canada. The purchases may be made for plaintiff's own benefit. The fact that plaintiff becomes indebted for the purchase price to Carding Canada rather than to defendant is a matter between plaintiff and Carding Canada. Case Credit Corp. v. Eagle Equipment Co., 7 N.C.App. 29, 171 S.E.2d 46.
Defendant argues that to permit plaintiff to maintain this action would expose defendant to double liability in that Carding Canada could still sue for defendant's indebtedness under the agreement, even if the indebtedness is recovered by plaintiff in this action. This position is unsound because the agreement provides in paragraph 3 that the purchase price of any equipment purchased, by plaintiff or any other Carding Company, is to be set off against defendant's indebtedness to Carding Canada. Moreover, since Carding Canada has been ordered made a party, the contention that it may subsequently bring another suit for this identical claim is no longer pertinent.
It is our opinion that plaintiff has standing to maintain this action and the court's order denying plaintiff's motion to dismiss on the merits on the grounds plaintiff is not the real party in interest was proper.
Plaintiff's appeal modified and affirmed.
Defendant's appeal affirmed.
BROCK and VAUGHN, JJ., concur.
