The plaintiff filed his complaint, alleging that he is the owner of a certain tract of land; that the defendant claims an interest therein adverse to him which is without right, and praying that the defendant be required to set forth the nature of his claim; that all adverse claims be determined; that plaintiff be adjudged the owner of the land; and that defendant be debarred from asserting any claim thereto. The defendant filed an answer and cross-complaint, in each of which he alleged certain facts upon which he claimed damages for a breach of contract, and that the same was a lien upon the premises, which he asked to be foreclosed. Upon the trial, after the plaintiff had closed his case, the defendant offered evidence in support of the allegations of his affirmative answer and cross-complaint, to which objection was made by the plaintiff and sustained by the court, upon the ground that the matters alleged did not show that the defendant had any interest in the land in question. Judgment was thereupon given to the plaintiff, from which the defendant appeals.
The claim of the defendant was, that in 1898 the plaintiff and defendant entered into a written contract as follows, to wit: "I hereby agree to sink a well for Marius Meyer and develop not less than fifty inches of water. Meyer agrees to pay for said work one hundred dollars per inch in land on the Meyer ranch. If less than fifty miner's inches *Page 497 is developed, no charge is to be made for the work. If more than fifty inches is developed, Meyer is to pay in land at the rate of one hundred dollars per inch of water so developed. Land to be valued at fifty dollars per acre. Meyer shall have the right to pay Quiggle in cash, if he so desires, instead of in land, at his option, at the rate of one hundred dollars per miner's inch. During work, board for Quiggle and one man is to be furnished by Meyer free of charge, and also all horses and assistance that may be needed in hauling machinery, etc. Meyer is to furnish clear title to land and release same from existing mortgage"; that in pursuance of this contract the defendant began to sink a well on the premises described, and continued in good faith and with due diligence in the prosecution of the work until May, 1899, at which time he had sunk the well to a depth of three hundred and twenty feet, and that at one time for more than forty hours more than one thousand miner's inches of water flowed from the well, but that thereafter it became clogged with gravel and sand and did not flow regularly; that the defendant continued in his efforts to sink the well farther until the latter part of June, at which time the plaintiff refused to allow him to proceed farther with the work, whereby he claimed that he was damaged in the sum of one hundred thousand dollars.
It is clear that under the contract the defendant had no interest whatever in the land nor any right to a conveyance which would be specifically enforced. No specific land was described to which the defendant was to be entitled to a conveyance if he had fully performed the contract, and it was therefore unenforceable. (Civ. Code, sec. 3390) In addition to this, it was entirely optional with Meyer to pay for the sinking of the well in land or in money. It is also clear that there is no lien on the land by virtue of the contract, taken in connection with the allegations of the answer and cross-complaint. There is nothing to show that the defendant ever filed or claimed a lien under the Mechanic's Lien Law, and the contract itself does not purport to give the defendant a lien upon the land for the value of his services in performing the contract. The claim of the defendant, therefore, does not affect the real estate in any *Page 498 particular. It has no more relation thereto, in legal effect, than if it were an independent contract for the payment of money or an independent cause of action in tort against the plaintiff. 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." (Code Civ. Proc., sec. 442.) This action was not brought upon contract, and the complaint does not set forth any transaction which could give rise to the claim of the defendant, or upon which the relief sought by the defendant depends. And the facts stated do not show any right of defendant affecting the land. It is therefore not proper as a cross-complaint.
The affirmative allegations of the answer set forth no defense to the action to quiet title begun by the plaintiff, unless it comes within the definition of counterclaim given in subdivision 1 of section 438 of the Code of Civil Procedure. Under that subdivision a counterclaim must arise out of: "1. A cause of action arising out of a transaction set forth in the complaint as the foundation of the plaintiff's claim, or connected with the subject of the action." As has been stated, the claim of the defendant does not arise out of any transaction set forth in the complaint as the foundation of the plaintiff's claim. The plaintiff's claim is founded upon his title to the property. His cause of action arises out of the wrongful and unfounded claims of the defendant, but there is no transaction set forth out of which a counterclaim for damages could arise. It may possibly be contended that the claim of the defendant is connected with the subject of the action within the meaning of the last clause of this subdivision of section 438, and can therefore be maintained as a counterclaim. The subject of the action, however, is the land, to which it is alleged the defendant makes an unfounded claim. (Bliss on Code Pleading, 3d ed., sec. 126.) The claim of the defendant has no connection with the land within the meaning of the statute under consideration. The question whether a claim such as is here alleged is connected with the subject of the action has been the subject of numerous decisions in other states, although in this state there has been no adjudication concerning it. It is treated at considerable length in *Page 499 Bliss on Code Pleading (secs. 386-389), and also in Pomeroy's Code Remedies (secs. 745, 767, 775, 791, 793). The leading case on the subject is approved by those writers, and has been followed by the courts in other states in many decisions. We refer to the case of National Fire Ins. Co. v. McKay, 21 N.Y. 191. In that case the court say: "A counterclaim, when established, must in some way qualify or defeat the judgment to which a plaintiff is otherwise entitled. In a foreclosure suit a defendant who is personally liable for the debt, or whose land is bound by the lien, may probably introduce an offset to reduce or extinguish the claim. But where his personal liability is not in question, and where he disclaims all interest in the mortgaged premises, I do not see how he can demand a judgment against the plaintiff on a note, bond, or covenant." There is no reason for allowing the defendant to maintain a counterclaim for damages in this action which would not exist in case he should in answer to a suit to quiet title, set up a counterclaim upon a promissory note, or any other independent cause of action for money. The two cases have no relation to each other. The relief to which he would be entitled upon the one claim would not affect, modify, or change in any way the decree to which the other party would be entitled. It was not the intention of the reformed procedure to allow persons having independent claims against each other, the relief authorized in one having no relation to that which could be given in the other, nor in any manner affecting it, to settle them all in one action upon the sole ground that, as they had been brought into court to contend against each other with respect to one case or dispute, they should at that time and place settle all other matters of controversy existing between them. The court did not err in refusing to allow the defendant to introduce evidence in support of his answer and cross-complaint. Those pleadings set forth no defense whatever to the plaintiff's action, and the plaintiff would have been entitled, if he had asked it, to a judgment upon the pleadings.
For these reasons the judgment of the court below is affirmed.
Angellotti, J., and Van Dyke, J., concurred. *Page 500