
38 Cal.App.2d 711 (1940)
THE METROPOLITAN CASUALTY INSURANCE COMPANY OF NEW YORK (a Corporation), Plaintiff,
v.
J. MARGULIS et al., Appellants; A. HERSHELL et al., Respondents.
Civ. No. 11889. 
California Court of Appeals. Second Appellate District, Division One.  
May 3, 1940.
 Emmett A. Tompkins for Appellants.
 Rutherford, Jacobs, Cavalero & Dietrich for Respondents.
 White, J.
 This is an appeal from an order granting a motion to strike a cross-complaint.
 Metropolitan Casualty Insurance Company commenced the present action by filing a complaint alleging in substance that the defendants, J. Margulis and Jack Stullman, having theretofore subdivided a tract of land and prepared a map thereof containing a certificate of dedication to public use of streets, avenues and alleys shown on said map, entered into a written agreement with the county of Los Angeles whereby, in consideration of the acceptance by the county for public use of the streets, avenues and alleys so offered for dedication, said defendants, Margulis and Stullman, agreed to construct within one year certain improvements upon said tract, to wit, grading and surfacing, curbs, sidewalks and storm drain; that said agreement further provided for the filing of a bond to secure the faithful performance of the terms of said agreement; that the defendants, as principals, and the plaintiff, Metropolitan Casualty Insurance Company, as surety, made, executed and delivered to the county of Los Angeles such a bond in the sum of $15,650; that the defendants performed the work required by the agreement only in part; that the county subsequently commenced an action against defendants and the casualty company which resulted in a judgment against defendants and the casualty company *713 for the principal amount of the bond, interest and costs, which the casualty company paid, and for which in the present action it seeks reimbursement from the defendants.
 Defendants filed an answer admitting, by failure to deny, all the material allegations of the complaint, but nevertheless denying the conclusion of law "that plaintiff is entitled to a judgment". At the same time there was filed by Margulis and Stullman, the defendants, and Margulis-Stullman Company, a corporation, a cross-complaint, naming A. Hershell, Max Rosenthal, Dorothy Rosenthal, Bank of America National Trust and Savings Association, and Stockton Savings & Loan Bank as cross-defendants, wherein it was alleged that cross-defendant Hershell held a mortgage on said tract in the sum of $72,500 which he had transferred to Stockton Savings & Loan Bank "as collateral security"; that cross-complainants sold a large number of lots in the tract on instalment contracts and that the same were deposited with Bank of America "for collection as funds for A. Hershell and Max Rosenthal and Dorothy Rosenthal"; that "as part of the consideration of the cross-complainants transferring to Max Rosenthal, Dorothy Rosenthal and A. Hershell all of the unsold lots and purchasers' contracts ... A. Hershell, Max Rosenthal and Dorothy Rosenthal agreed in writing to install, at their own expense, sidewalks and curbs on the streets in said tract and to make, grade and surface the streets", but had failed to do so, whereupon the county of Los Angeles, as hereinbefore set forth, had recovered a judgment against the bonding company, to the damage of cross-complainants. Cross-complainants prayed for judgment against cross-defendants in the amount of $19,688.46, being the same amount for which plaintiff, Metropolitan Casualty Insurance Company, sought judgment against defendants.
 Upon motion of the cross-defendants the court entered an order striking the cross-complaint, and from such order cross-complainants prosecute this appeal, contending that the court in so doing abused its discretion.
 [1] Authority for the filing of a cross-complaint must be found in either section 442 or 389 of the Code of Civil Procedure. Section 442 provides that "whenever the defendant seeks affirmative relief against any party, relating to or depending upon the contract, transaction, matter, happening or accident upon which the action is brought, or affecting *714 the property to which the action relates, he may, in addition to his answer, file at the same time, or by permission of the court subsequently, a cross-complaint. ...". Section 389, so far as here pertinent, provides that "when a complete determination of the controversy cannot be had without the presence of other parties, the court must then order them to be brought in, and to that end may order amended and supplemental pleadings, or a cross-complaint to be filed, ...".
 In the instant case it should be noted that the cross-complaint was filed not only in the name of the two defendants in the action, but also on behalf of a third party who was a total stranger to the pending litigation. Also, that the cross-complaint attempted to set up a cause of action against cross-defendants for damages for breach of an agreement to install improvements, which agreement was entered into between cross-complainants and cross-defendants Max Rosenthal, Dorothy Rosenthal and A. Hershell, none of whom were parties to the pending suit, which was one by plaintiff surety on a bond to recover moneys paid on behalf of defendant principals. In such a situation, can defendants join with a stranger to the action and file a cross-complaint, not against the plaintiffs in the initial action, but against third parties, to recover damages for breach of an agreement to which the plaintiff was not a party? We think not. As was said in Alpers v. Bliss, 145 Cal. 565, 570 [79 P. 171]:
 "Section 389 of the Code of Civil Procedure provides: 'The court may determine any controversy between parties before it, when it can be done without prejudice to the rights of others, or by saving their rights; but when a complete determination of the controversy cannot be had without the presence of other parties, the court must then order them to be brought in, and to that end may order amended and supplemental pleadings, or a cross-complaint to be filed and summons thereon to be issued and served.' This section does not give the court power to bring into the action for determination a controversy between a defendant and strangers to the action which is irrelevant to the action between the parties already before it, except for the purpose of making its determination of the controversy between the parties already before it complete, and without prejudice to the rights of others. A defendant cannot inject into the action a controversy between himself and an outsider, even though it affects the property to which the action relates, unless some *715 party already before the court is interested in, or will be affected by, the determination of such controversy. 'The controversy' named in the concluding member of the above-quoted sentence is 'any controversy between the parties before it' named in the first clause, and includes a controversy presented by a cross-complaint, as well as that presented by the original complaint. (Winter v. McMillan, 87 Cal. 256 [25 P. 407, 22 Am.St.Rep. 243]; Mackenzie v. Hodgkin, 126 Cal. 591 [59 P. 36, 77 Am.St.Rep. 209]. See, also, East Riverside etc. Dist. v. Holcomb, 126 Cal. 315 [58 P. 817]; Boskowitz v. Thompson, 144 Cal. 724 [78 P. 290].) In either case the 'other parties' who may be brought in must be persons whose presence is essential to the complete determination of a controversy between parties who are already before the court. It is 'to that end' that the court is authorized to order a cross-complaint to be filed, and a summons thereon to be issued and served. ..."
 See, also, Brady v. Kobey, 27 Cal.App.2d 505 [81 PaCal.2d 263].
 [2] Under the provisions of section 442 of the Code of Civil Procedure, the test is whether the matter set up by the cross-complaint bears the necessary relation to the matter constituting the cause of action. True, if such relation is present, it is immaterial that the relief sought by the cross-complaint is independent of that prayed for in the complaint, and the cross-complaint may not tend to diminish or defeat the plaintiff's recovery, but may demand affirmative relief distinct from that prayed for by the plaintiff. The validity of the cross-complaint herein therefore depends upon whether it comes within the "contract" or "property" clauses of the section, and this must be determined from the facts surrounding the cause of action and not particularly from the form of the complaint. In the case before us the cause of action stated in the original complaint was for recovery of moneys paid by plaintiff surety company on behalf of defendants, while the cross-complaint attempted to add a stranger as a cross-complainant and to recover damages from third parties for a breach of an agreement between such third parties and cross-complainants relating to the installation of certain improvements. Instead of being "related" to the same transaction or contract, each claim is foreign to the other. *716
 [3] Neither is the cross-complaint justified by the provisions of section 389 of the Code of Civil Procedure, because, as heretofore pointed out, it is only when their presence is essential to a complete determination of the controversy already before the court that strangers may be brought in through the medium of a cross-complaint. Therefore, if for no other reason, the ruling of the trial court striking out the cross-complaint should be sustained, because the cross-complaint sought to bring in new parties not necessary to a determination of the matter before the court. (Alpers v. Bliss, supra.) In the original action plaintiff was not seeking any relief against the cross-defendants, nor could it. None of the cross-defendants was a party to the surety bond upon which the action was predicated. They were not concerned with nor could they be considered in the trial of any issue that might arise between plaintiff surety and the defendant principals on the bond. Further, no triable issue was raised by the pleadings before the court, because the answer of the defendants admitted all the material allegations set forth in the complaint.
 [4] The ruling striking the cross-complaint works no prejudice upon cross-complainants, for the reason that it does not operate as a bar to any future action on their part. They are not precluded from proceeding in an independent suit against the named cross-defendants for breach of the contract allegedly existing between them and cross-complainants. (Merchants Trust Co. v. Bentel, 10 Cal.App. 75 [101 P. 31]; Clark v. Kelley, 163 Cal. 207, 209 [124 P. 846]; Andreson Co. v. Regenold, 166 Cal. 44, 47 [134 P. 999]; Lewis v. Fox, 122 Cal. 244 [54 P. 823]; Johnson v. Risdon, 89 Cal.App. 768 [265 P. 505].)
 The rule in regard to the filing of a cross-complaint is thus succinctly stated in United Casting Co. v. Duncan, 44 Cal.App. 384, 388 [186 P. 403]:
 "A cross-complaint can be maintained only when the defendant seeks affirmative relief relating to or depending upon the contract, or transaction upon which the action is brought, or affecting the property to which the action relates. Persons having independent claims against each other, the relief authorized in one having no relation to that which can be given in the other, nor in any manner affecting it, are not permitted to settle them all in one action upon the sole ground that, as they are in court contending against each other, with *717 respect to one case, or dispute, they should at that time and place settle all other matters of controversy existing between them. (Meyer v. Quiggle, 140 Cal. 495, 499 [74 P. 40]; Clark v. Kelley, 163 Cal. 207, 209 [124 P. 846].)"
 From the foregoing it follows that the order appealed from should be, and it is, affirmed.
 York, P. J., and Doran, J., concurred.
