This action was brought by what is known as a Carey act company against a settler upon lands under said company’s canals, to foreclose a lien on the interest which the settler has in the land and water right. The action is based on contracts between the plaintiff corporation and the defendant, whereby the company sold and the defendant purchased, water rights for the irrigation of certain lands described in the complaint.
The complaint alleges four separate causes of action and the prayer is for a judgment and decree for the amount claimed in each cause of action, and for a foreclosure sale of *715whatever interest the defendant has in and to such water rights and the said lands.
To this complaint the defendant demurred to each cause of action, the demurrer being based on three grounds: (1) That the complaint does not state a cause of action; (2) That paragraph 9 of each cause of action is ambiguous, uncertain and unintelligible, in that the complaint pleads “That the plaintiff has performed all of the conditions of the said contract required to be performed to entitle it to the relief sought in this action, ’ ’ and that from said allegation defendant cannot determine what requirements, if any, have been performed on the part of the plaintiff sufficient to enable the defendant to answer; and (3) That there is a defect consisting of nonjoinder of parties defendant in that the complaint shows that the title to the land is in the federal government and that the action is against the defendant C. W. Dill and the United States is not made a party, and the plaintiff seeks in its complaint to obtain a fee simple title to the land.
Said demurrer was overruled as to the first two grounds and sustained as to the third, thereby holding that the United States was a necessary party to said action. The plaintiff was given ten days in which to file an amended complaint, but it declined to amend, and the court entered a judgment of dismissal. From that judgment this appeal was taken.
The only question presented on this appeal is whether the court erred in sustaining the demurrer upon the ground that the United States was a necessary party to the action.
Under sec. 4101, Rev. Codes, it is provided that all persons having an interest in the subject of the action and in obtaining the relief demanded may be joined as plaintiffs except when otherwise provided in the code. (Boise City v. Wilkinson, 16 Ida. 150, 102 Pac. 148.) Sec. 4102, as amended by Laws of 1909, p. 20, provides that any person may be made a defendant who has or claims an interest in the controversy adverse to the plaintiff, or who is a necessary party to a complete determination or settlement of the . question involved. *716See. 4105 provides that of the parties to the action, those who are united in interest must be joined as plaintiffs or defendants, but if the consent of anyone who should have been joined as plaintiff cannot be obtained, he may be made a defendant. (As to “parties,” see, also, First Nat. Bank v. Bews, 3 Ida. 486, 31 Pac. 816; Van Camp v. Board of Commrs., 2 Ida. 29, 2 Pac. 721.)
The general definition of “parties to an action” is well stated in 15 Ency. Pl. & Pr., p. 463, as follows: “The term ‘parties to an action’ is used to designate the person or persons seeking to establish a right and the person or persons upon whom it is sought to impose a corresponding duty or liability.” And at page 584 the author states that the general rule as to parties in equity cases is that ‘ ‘ all persons who are materially interested in the event of the suit or in the subject matter, however numerous, should be made parties either as plaintiffs or as defendants.” The rule there stated is subject to a. number of well-defined exceptions. (Id., pp. 606, 608, 655.) That author states at p. 621, that: “Whether or not one is an indispensable party depends in large measure upon the relief sought.”
Mr. Justice Story, in his Equity Pleading, sec. 72, states as follows: “It is not all persons who have an interest in the subject matter of the suit, but in general those only who have an interest in the object of the suit who are ordinarily required to be made parties.”
It is stated in Calvert in his treatise on Parties to Suits in Equity, p. 10, as follows: “The propriety of a person being made a party depends upon his interest, not in the subject matter, but in the object of the suit.” (Van Keuren v. McLaughlin, 21 N. J. Eq. 163; Wilson v. Castro, 31 Cal. 420.)
It is admitted that the title to the lands described in the complaint is in the United States, and it is clear that that title can in no way be affected by the foreclosure of said liens upon said water rights and the interest that the defendant has in said lands. This action involves only questions between the appellant, the Idaho Irrigation Co., and the de*717fendant, growing out of certain contracts between those parties and the liens provided for in said contracts. Said liens are granted in favor of a Carey act company as provided for by see. 1629, Rev. Codes, which is in part as follows:
“ . . . . Any person, company or. association, furnishing water for any tract of land, shall have a first and prior lien on said water right and land upon which said water is used, for all deferred payments for said water right; .... The contract for the water right upon which the aforesaid lien is founded shall be recorded in the office of the recorder of the county where said land is situate.”
That section also provides that upon the default of any deferred payments for water rights, the lienholder may foreclose the same according to the terms and conditions of the contract for the water right, and also provides for a redemption within nine months after the foreclosure sale. The water right contracts were made under the provisions of that section. The United States is not a party to either of said contracts and has no interest whatever in the performance of them.
The object of this suit is to enforce the remedy given a Carey act company under the provisions of said see. 1629 for the breach of water contracts, while the prayer of the complaint is that the amounts due on each of said contracts be declared a first lien upon said lands and the water rights appertaining thereto, and that the premises be ordered sold in the manner prayed for relative to the lands described in exhibit “B” attached to said complaint. The full relief prayed for, so far as title to the land is concerned, is greater than the party is entitled to. It is well settled that the prayer of a complaint cannot enlarge its allegations (Board of Commrs. v. Cutler, 7 Ind. 6); that the prayer for improper relief will not vitiate a pleading otherwise sufficient (Mark v. Murphy, 76 Ind. 534); and that a prayer for relief does not constitute any part of the statement of the cause of action. (Bancroft v. Atyeo, 22 Kan. 32.) A prayer cannot change the legal effect of the facts alleged in the charging part of the com*718plaint. (Wilks v. Kreis (Tex. Civ. App.), 134 S. W. 838; Erie City Iron Works v. Thomas, 139 Fed. 995.) It is stated in 16 Ency. Pl. & Pr., p. 776, that the prayer being only a matter of form, the cause of action, if properly stated, cannot be reached by demurrer. (Rollins v. Forbes, 10 Cal. 299.) An erroneous claim of damages does not make a complaint demurrable. (Sunnyside Land Co. v. Willamette Bridge Ry. Co., 20 Or. 544, 26 Pac. 835.)
It is settled by an unbroken line of authorities that, in determining the sufficiency of the complaint when attacked by demurrer, the facts alleged in the charging part of the complaint are the only facts placed before the court for consideration. The relief which the plaintiff may demand in his prayer is nothing more than the statement of his opinion as to what relief the facts stated in the complaint entitle him to receive; and it is a rule among good pleaders to make the prayer for relief as comprehensive as possible so as to include any relief to which the parties may be entitled under the facts pleaded. The effect of the allegations of the complaint cannot be determined by the prayer. The appellant does not pray for any judgment against the United States, and they admit that the appellant neither wdshes nor has any right or authority .or intention to attack the title of the United States to said lands in this action. The defendant has settled upon said lands, the title to which is yet in the United States,' by permission of the federal government. This permission is extended in the first instance by the Carey act of Congress to the state, and the settler is then permitted by the state to settle upon the lands upon certain conditions which are embodied in sec. 6 of the contract between the state of Idaho and the appellant, which contract is attached to and made a part of the complaint. See. 6 of the supplementary agreement between the parties is to the following effect:
The state “agrees that it will not approve any application for, or filing on, the lands herein referred to until the person or persons so applying shall furnish to the said Board [State Board of Land Commissioners] a true copy of the contract *719entered into with the party of the second part [Idaho Irrigar tion Company] for the purchase of sufficient shares or water rights in said reservoir and irrigation system for the irrigation of said lands.”
The contract for the “purchase of sufficient shares of water rights” is the contract referred to in said sec. 1629, and in this case constitutes the exhibits “B,” “C,” “D” and “E” attached to the complaint. The settler is on these lands upon condition of signing or executing said contracts, which fact implies the condition that the contracts shall be fulfilled according to their terms. It is alleged in the complaint that the conditions have been” broken, and in seeking to enforce its remedy for such breach, the appellant is proceeding against the interest of the settler in and to the land and water rights. The effect of a decree entered under the allegations of said complaint would simply be the sale of the settler’s interest in said land and water rights, which could be bought at a foreclosure sale by another settler who could thereupon take possession of the land and complete the contract with the appellant company. Said section 1629 provides for redemption by the “original owner against whom the lien has been foreclosed” at any time within nine months after the foreclosure sale. This was intended to protect the rights of the settler in default, but the wording of the section itself clearly indicates by providing for the redemption by the original settler that it is not intended, when proceeding under this section, to attack any interest of the federal government in such lands; and even if it were so intended, the title of the federal government could not be successfully attacked.
For the purposes of this demurrer, all of the facts that can be considered by this court are those appearing upon the face of the complaint, and it does not appear in the complaint that the nonjoinder of the United States, as a party defendant to this action has in any maimer prejudiced any interest of the respondent.
In case the appellant is entitled to a foreclosure and sale, the defendant has a right to redeem from such sale at any *720time within nine months and then may proceed and obtain his title from the state as provided by law. If he does not redeem, the foreclosure sale can in no manner interfere with or affect the title of the United States in and to said lands. It is elementary that if a person is not made a party to an action, his rights cannot be determined or affected by a judgment or decree entered in such ease. Every person has a right to his day in court, and, as before stated, by the allegations of the complaint it is clearly shown that the plaintiff is not seeking in any manner to cloud or interfere with the title of the United States.
In this case it is not sought to acquire any title from the government or to foreclose any right or interest the government has in and to this land. So far as the present action is concerned, it seems to be prosecuted on the theory alone of acquiring such interest only as the settler has acquired and to foreclose whatever property interest he has acquired in and to this land. The question as to whether or not one who attempts to foreclose a lien for cost of construction of an irrigation system and to supply water for reclaiming land, can, under the act of Congress authorizing such a lien, acquire the paramount title from the United States in a proper action, is not involved in this case and so we are not called upon to pass upon that question. If a party foreclosing such a lien should seek to acquire a fee simple title in and to the land and foreclose as against the United States, it would be necessary to make the government a party defendant in the action. It is thought by some that under the act of Congress conferring the right of a lien for cost of construction of irrigation works under the Carey act that the fee simple and paramount title might be acquired under a foreclosure sale in such action. We refrain, however, from discussing or passing upon that question.
The court erred in sustaining said demurrer and entering the judgment of dismissal. The judgment must therefore be reversed, and it is so ordered, and the cause is remanded to the trial court with directions to overrule said demurrer and *721permit the defendant to answer. The costs of this appeal are awarded to the appellant.
Ailshie, C. J., and Stewart, J., concur.