
    (December 7, 1907.)
    VALLEY LUMBER & MANUFACTURING CO., Respondent, v. JOHN DRIESSEL, Administrator, et al., Appellants.
    [93 Pac. 765.]
    Mat-erialman’s lien — Material Furnished Under Two Separate Contracts — Filing Lien — Tacking One Contract on to Another —Time for Filing cannot be Extended — Material Furnished in Installments — Notice of Two Contracts — Evidence—Sufficiency of — Foreign Corporation — Complaint—Pleading—Capacity to Sue — Pleading Compliance with State Law — Demurrer — Grounds for — Failure to Raise Question by Answer or Demurrer — Question of Compliance Waived.
    1. D. contracted with M. to construct a dwelling-house, and M. contracted with the Y. L. Co. to furnish the material, which it did, and M. completed the dwelling on the sixteenth day of January, 1905. Thereafter, on the thirteenth day of March, 1905, D. contracted with M. to erect a. porch to said dwelling, and M. on that day ordered lumber for said porch from the Y. L. Co., which was furnished by them, the last of it being furnished on the 15th of March, 1905. Thereafter, on the eleventh day of May, 1905, the Y. L. Co. filed its materialman’s lien on said premises; held, that the erection of the dwelling and the porch was done under separate contracts, but it is not shown by the evidence that the Y. L. Co. had notice or knowledge that said dwelling and porch were erected under separate contracts, and for that reason, held, that the Y. L. Co.’s lien was filed in time.
    2. A materialman who furnished material for the erection of a braiding under two separate contraéis, and has knowledge of such contracts, cannot tack one contract to the other by filing his claim of lien within the required time from the date of furnishing material pursuant to one of the contracts.
    3. The time for filing a lien cannot be extended by furnishing on a new contract or request additional articles and adding them to a completed account and statement of material furnished.
    4. Where materials are furnished for the same building or improvement in installments and at intervals, and the parties intend them to be included in one account and settlement, the entire account will be treated as a continuous and connected transaction, and the time in which to file the lien begins to run from the date of the last item of the account.
    
      5. Under the laws of this state, a foreign corporation, in order to maintain an action in the courts of this state, must allege a compliance with the constitution and statutes in regard to designating an agent upon whom service of process may be had, and in filing its articles of incorporation as required by law, and a complaint by such corporation that fails to allege such facts is subject to demurrer. However, the defendant will waive the question of noncompliance if he fails to raise the same by demurrer or answer, and cannot raise it for the first time in the appellate court.'
    6. The case of Katz v. Herrick, 12 Idaho, 1, 86 Pac. 873, cited and approved.
    7. Section 4174, Revised Statutes, provides that a defendant may demur to the complaint on seven separate and distinet grounds, the second being “that plaintiff has no legal capacity to sue,” and the sixth is, “that the complaint does not state facts sufficient to constitute a cause of action.” The clear intent of the provisions of that section is, if one desires to demur to a complaint on the ground that the plaintiff has no legal capacity to sue, he must so state in his demurrer, and cannot raise the question of the legal capacity of the plaintiff to sue on the ground that the complaint does not state a cause of action.
    8. A cause of action may exist in favor of a corporation or person who has not the capacity to sue, and an action brought by such person or corporation on a complaint alleging a good cause of action ■would not be obnoxious to a demurrer on the ground that it does not state a cause of action.
    9. If, as in the case at bar, a foreign corporation fails to allege its compliance with the domestic law, the complaint is demurrable on the ground that it fails to allege the capacity of the plaintiff to sue. The objection on that ground may also be taken by answer under the provisions of section 4177, Revised Statutes. Under the provisions of section 4178, Revised Statutes, if no objection to the complaint is taken, either by demurrer or answer, the defendant is deemed to have waived the same, excepting, only, the objection to the jurisdiction of the court and the objection that the complaint does not state facts sufficient to constitute a cause of action.
    10. Where the complaint, on its face, shows the want of capacity •of the plaintiff to sue, the question of want of capacity cannot be raised by demurrer on the ground that the complaint fails to state .a cause of action.
    11. A corporation or individual may have a good cause of action and still have no capacity to sue; and may have a capacity to sue and no cause of action.
    12. The demurrer must be confined to the specific grounds stated ■therein.
    
      13. Held, that the question of the capacity of the respondent to sue was not raised in the court below by demurrer or answer, and for that reason was waived.
    (Syllabus by the court.)
    APPEAL from the District Court of Nez Perce County. Hon. Edgar C. Steele, Judge. ,
    Action to foreclose a mechanic’s lien. Judgment for plaintiff.
    
      Affirmed.
    
    Charles L. McDonald, for Appellants.
    That the plaintiff had notice of the completion of the first contract when it was finished cannot be doubted when we see from the evidence that four days thereafter, viz., January 20th, it furnished Mr. Morrison with a full statement of his account for lumber used on the job. If it has a lien at all, it is only by tacking the porch contract to the house contract and making it a continuous one. As is shown by Mr. Morrison’s testimony, Mr. Driessel, on the fifty-ninth day, without any previous understanding or agreement, made the contract for the building of the porch, and a small amount of lumber was furnished for that purpose.
    “As soon as the lien has all accrued — that is, when the materials for the same job have all been furnished — the time limited for making it secure begins to run, and no materials subsequently delivered for something determined upon after the job is finished can stop the running of said time.”' (Frankoviz v. Ireland, 34 Minn. 403, 26 N. W. 225; Sanford v. Frost, 41 Conn. 617; Scott v. Cook, 8 Mo. App. 193; Fay v. Muhker, 20 N. Y. Supp. 671; Schulenberg v. Vrooman, 7 Mo. App. 133; Central Loan & Trust Co. v. O’Sullivan, 44 Neb. 834, 63 N. W. 5.)
    Plaintiff, being a foreign corporation which had not complied with the laws of this state, is entitled to no relief. {Katz v. Herrick, 12 Idaho, 1, 86 Pac. 873.) It must affirmatively appear that the foreign corporation has complied with the laws of the state before it can maintain its action. (Far
      
      rier v. New England Mtg. Security Go., 88 Ala. 275, 7 South. 200; Mullens v. American etc. Land & Mtg. Go., 88 Ala. 280, 7 South. 201.)
    Such an act is a condition precedent, and must be both alleged and proven. (Taber v. Interstate Bldg. & Loan Assn., 91 Tex. 92, 40 S. W. 954; Peters v. Brewing Assn. (Tex. Civ. App.), 55 S. W. 516; Chapman v. Cash Register Co., 32 Tex. Civ. App. 76, 73 S. W. 969; Ice Mfg. Co. v. Armour, 12 Pa. Super. Ct. 443; Welsbach Co. v. Norwich Gas etc., 89 N. Y. Supp. 284, 96 App. Div. 52.)
    “The declaration is fatally defective in not alleging that the plaintiff company had obtained a license which was in force.” (Lycoming Fire Ins. Co. v. Wright & Son, 55 Vt. 523.)
    C. H. Lingenfelter, for Respondent.
    Morrison and Driessel could have made as many different contracts for construction of the various parts of the building as they desired, but such contracts could not militate against the materialman without his knowledge of such contracts.
    Where materials are furnished for the same improvement in installments and at intervals, but the parties intend them to be included in one account and settlement, the entire account will be treated as a continuous and connected transaction, and the lien limitation begins to run from the last item of it. (Jones & Magee Lumber Co. v. Murphy, 64 Iowa, 165, 19 N. W. 898; Page v. Betts, 17 Mo. App. 375; Pullis v. Hoffman, 28 Mo. App. 666; Bruns v. Braun, 35 Mo. App. 337; Louisiana etc. Lumber Co. v. Myers, 87 Mo. App. 671; Darling-ton Lumber Co. v. Harris, 107 Mo. App. 148, 80 S. W. 688.)
    The defendants neither by demurrer nor answer questioned the authority of the company to do business in the state.
    This can only be raised by answer; otherwise it is waived. {Ontario State Bank v. Tibbits, 80 Cal. 68, 22 Pac. 66; Phillips v. Goldtree, 74 Cal. 151, 13 Pae. 313, 15 Pac. 451; Southern Pac. R. Co. v. Pursell, Hi Cal. 69, 18 Pac. 886-889; Dahl v. Montana Copper Co., 132 U. S. 264, 33 L. ed. 325, 10 Sup. Ct. Rep. 97; Ency. of PI. & Pr., 89, 90, and cases cited; Wetzel & T. B. Co. v. Tennis Bros. Co., 145 Fed. 458.)
    Where it does not appear affirmatively that the plaintiff has done business in the state in contravention of the statutes, a demurrer will not lie because the petition fails to allege that the statutory conditions have been complied with. In such cases noneomplianee is a defense to be set up by answer. (Smith v. Sewing Machine Co., 26 Ohio St. 562; New England etc. Ins. Co. v. Bobinson, 25 Ind. 536; Sprague v. Lumber Co., 106. Ind. 242, 6 N. E. 335; Nickels v. Association, 93 Va. 380, 25 S. E. 8; American etc. Sewing Machine Co. v. Moore, 2 Dak. 280, 8 N. W. 131; New England Security v. Vader, 28 Fed. 265; Cassaday v. American Ins. Co., 72 Ind. 95; Northern Assur. Co. v. Borgelt, 67 Neb. 282, 93 N. W. 227.)
   SULLIVAN, J.

This is an action brought to foreclose a materialman’s lien under the provisions of the mechanic’s lien law of this state. One Driessel was the owner of the premises and contracted with one Morrison for the construction of a dwelling-house on the premises described in the complaint. It is alleged in the amended complaint that the plaintiff, who is respondent here, is a corporation organized under the laws of the state of Washington, and doing business in the town of Lewiston, Idaho; that said Driessel is the owner of the premises described in the complaint, and that the defendant Morrison was the contractor and agent of Driessel, and as such agent entered into a contract with the respondent, whereby it was to furnish the material for the construction of a certain dwelling-house; that the respondent furnished the material between the twenty-third day of November, 1904, and the fifteenth day of March, 1905, which material was actually used in the construction of said building, of the agreed value of $552.47; that there was thereafter paid on said account $300.98, leaving a balance due of $251.49, together with interest thereon, and that the plaintiff, within sixty days from March 15, 1905, the date of furnishing the last item of said lumber, duly filed its claim of lien on the eleventh day of May, 1905, in the office of the recorder of Nez Perce county. The defendants filed a general demurrer to the complaint, which was overruled by the court. They thereafter filed a joint answer, denying the material allegations of the complaint, except the corporate existence of the plaintiff, and admitted that Driessel was the owner of the premises described in the complaint. The cause was tried by the court without a jury and judgment was rendered in favor of the respondent. This appeal is from the judgment and order denying a new trial.

It appears from the testimony in the case that there were two contracts entered into between Morrison and Driessel. The first was for the building and construction of a dwelling-house which was completed on January 16, 1905, and the respondent rendered him a bill, or a statement, on the 20th of January, for all the lumber that he had used in the construction of said dwelling-house. It also appears from the record that Driessel rented the house before or about the time it was completed, and the tenants took possession thereof. Thereafter they desired a porch built on to said house, and it would appear that they expressed their desire to Driessel and he consented to have a porch built, and on the 13th of March, 1905, fifty-nine days after the delivery of the last item of material under the first contract, he entered into another contract with Morrison for the construction of said porch, and on that date Morrison ordered the lumber for its construction from the respondent, to the amount of about $25, and the respondent furnished the lumber for said porch on the thirteenth and fifteenth days of March. The respondent filed its materialman’s lien on the eleventh day of May, 1905, fifty-seven days after furnishing the last material for the porch.

It is first contended by counsel for appellant that as there were two separate contracts, one for the construction of the house and the other for the construction of the porch, that said contracts had no connection with each other and were entirely separate and severable, and that the last one cannot be tacked on to the first, and thus keep alive the materialman’s lien for the material furnished for the construction of the house for more than sixty days after its completion under the first contract.

The evidence shows beyond a doubt that the house was constructed under one contract and the porch under another and separate contract. It also shows that the house was completed about the sixteenth day of January, 1905, and that the owner leased the house about the time of its completion and the tenants took possession. It also appears that the owner lived in Genesee, Latah county; that he went to Lewiston on the 13th of March and his tenants persuaded him to have said porch constructed, and on that date he made a contract with the appellant Morrison to erect said porch. The contract for the porch was not made until about fifty-nine days after the respondent had furnished the last material for the construction of the house.

The court in its findings of fact virtually finds that the house and porch were constructed under one contract, but that finding is not supported by the evidence. The secretary of the respondent company testified that he did not know the house was completed on or about the sixteenth day of January, but his testimony is not very clear on that point. He testified further that Morrison told him that he put the lumber furnished on the 13th and 15th of March into the porch, while Morrison swears positively that the house was built under one contract and the porch under another and separate contract. The fact that the respondent presented Morrison with an itemized statement of all the lumber furnished for the construction of the house on the 20th of January, 1905, is very suggestive of the fact that the respondent was informed that the’building was completed, as Morrison testified on the completion of a building the company furnished him an itemized statement of the material furnished and that he checked it over to ascertain whether or not it was correct, but does not testify that he informed respondent that the contract was completed or that it had knowlédge of that fact. There is no positive testimony in the record showing that the respondent had information that the house and the porch were constructed under separate contracts. The circumstance of respondents furnishing an itemized statement of the lumber used in the construction of the house, to say the least, is suggestive and significant. If the record showed that the respondent had such information, the rule laid down in Central Loan & Trust Co. v. O’Sullivan, 44 Neb. 834, 63 N. W. 5, would apply. In that opinion, the court said: “A materialman cannot tack one contract to another so as to procure a lien for all the materials furnished under separate contracts by filing his claim within the required time from the date of furnishing material pursuant to one contract”; and in Schulenberg v. Vrooman, 7 Mo. App. 133, the court said: “Where all the items of an account except the last few were supplied under one contract and that contract was executed and the transaction closed, held, that the time for filing a lien could not be extended by furnishing on a new request additional articles and adding them to the completed account.” On this point see, also, Fay v. Muhlker, 20 N. Y. Supp. 671; Scott v. Cook, 8 Mo. App. 193; Sanford v. Frost, 41 Conn. 617; Frankoviz v. Smith, 34 Minn. 403, 26 N. W. 225.

It is contended by counsel for respondent that it had no knowledge that Morrison and Driessel had one contract for the house and one for the porch, and that the contract, so far as it was concerned, was continuous and entire and the time within which to file a lien dated from the date of the last item of material furnished. That, no doubt, was the theory upon which the trial court rendered its decision.

Among other authorities cited by respondent is the case of Darlington Lumber Co. v. Karris, 107 Mo. App. 148, 80 S. W. 688. In that case the company and one Taylor agreed to the estimate of the lumber to be used in the Harris building. Considerable extra lumber was furnished all along during the continuance of the original contract, and the undisputed testimony showed that the lumber was ordered for the extra work for which Taylor had a separate bid; that the respondent company had no fresh arrangement with him and knew nothing about there being another contract between Taylor and Harris or that they were furnishing material for a job to be done under a separate contract. The court said: “The interval between October 25th, when the last item was furnished for the completion of the original plan, and December 10th, when the lumber for the extras was sold, was too short a time to affect respondent with constructive notice of Taylor’s new arrangement with Harris.” That decision, no doubt, would have been different had the court found that Taylor had entered into a separate contract with Harris for doing a part of the work in the construction of said building, and the materialman had notice of that fact.

Where materials are furnished for the same building or improvement in installments and at intervals, and the parties intend them to be included in one account in settlement, the entire account will be treated as a continuous and connected transaction, and the lien limitation begins to run from the last item of the contract. (Jones & Magee Lumber Co. v. Murphy, 64 Iowa, 165, 19 N. W. 898; Darlington Lumber Co. v. Harris, supra; Louisiana etc. Lumber Co. v. Myers, 87 Mo. App. 671.) But where there are two separate and distinct contracts for the erection of a building, and the materialman knows that there are two contracts, he cannot tack the last contract to the first so as to procure a lien for all the materials furnished under the separate contracts where the time had expired for filing a lien for the material furnished under the first contract.

Wliile there are some facts and circumstances tending to show that the respondent had notice of the two contracts referred to in this case, the evidence is not such as to warrant the reversal of the judgment on the ground that the respondent knew or had notice of those two contracts. The fact as to whether the respondent had information that the porch was built under a separate contract was within the possession and knowledge of the appellants, and they should have proved that fact by a preponderance of the evidence if they relied upon it, which they failed to do.

The question whether the plaintiff is entitled to maintain this action, it being a foreign corporation, is raised by the record. The paragraph of the complaint alleging the corporate existence of the respondent is as follows: “That the plaintiff is and was at all the times herein mentioned a corporation organized and existing under and by virtue of the laws of the state of Washington, with its principal place of business at Clarkston, Washington, and doing business at Lewiston, Idaho. ’ ’

It will be observed that it is not alleged that the plaintiff had complied with the provisions of section 10 of article 11 of the state constitution, in designating an agent upon whom process may be served; and with the provisions of section 2653 of the Revised Statutes as amended by the Laws of 1903, which provides that a foreign corporation shall file with the county recorder of the county in this state, in which is designated its principal place of business in the state, a copy of the articles of incorporation of said corporation, duly certified by the secretary of state of the state in which said corporation was organized, and a copy of such articles of incorporation duly certified by the county recorder, with the secretary of state.

It is contended that the allegations of said complaint place the respondent in the status of an individual whose contracts and dealings in this state are absolutely void unless it affirmatively appears that it has complied with the above mentioned provisions of our statute and constitution. The question presented may be stated as follows: When it appears from the complaint that the plaintiff is a foreign corporation, whether the fact of its not having complied with the laws of this state in reference to designating an agent and filing its articles of incorporation is a matter of defense to be pleaded affirmatively in the answer and proven by the defendant, or whether the plaintiff has affirmatively placed itself in a position so that it is incumbent upon it to allege and prove that it has complied with the laws of this state, and is entitled to do business in the state or maintain an action in its courts.

Counsel for the respondent contends that the right of the plaintiff to do business in this state is not disputed by the pleadings; that the defendant,- neither by demurrer nor answer, questioned the authority of the company to do business in this state nor to maintain this action, and that that question could only be raised by demurrer or answer, and if not so raised, it is waived, and cites in support of that contention, Ontario Bank v. Tibbitts, 80 Cal. 68, 22 Pac. 66; Phillips v. Goldtree, 74 Cal. 151, 13 Pac. 313, 15 Pac. 451; Southern Pac. R. Co. v. Pursell, 77 Cal. 69, 18 Pac. 886-889; Dahl v. Montana Copper Co., 132 U. S. 264, 33 L. ed. 325, 10 Sup. Ct. Rep. 97; Wetzel & T. R. Co. v. Tennis Bros. Co., 145 Fed. 458.

The first case above cited, Ontario Bank v. Tibbitts, involved the foreclosure of a mortgage by a corporation, and the court there held that the complaint did not show that the plaintiff had complied with the provisions of ■ section 299, Civil Code of California, requiring foreign corporations to file their articles of incorporation and designate an agent upon whom process could be served, and could not maintain an action or proceeding in relation to property owned by it in such county “until such articles of incorporation shall be filed in the place directed by the general law and by the provisions of that section.” The court there said, in considering that section of the statute: “The failure of the plaintiff to file a copy of its articles of incorporation in the office of the county clerk, being mere matter of abatement, should be specially pleaded by the defendants; otherwise it was waived. ’ ’ Said section 299 is different from the provisions of our own statute, in that it does not make it unlawful for a foreign corporation to acquire property in the counties of that state, but it provides that they must file their articles of incorporation within fifty days after the purchase, and it also further differs from the provisions of our statute, in that it provides that such corporation shall not maintain any action or proceeding until their articles of incorporation have been filed as provided by law. Under the provisions of that section, a corporation that had failed to comply with the law in regard to filing its articles of incorporation could begin an action, and the day before the action was tried, might file its articles of incorporation and thereby have the right to maintain said action. Under the provisions of our constitution and law, it was held in the case' of Katz v. Merrick, 12 Idaho, 1, 86 Pac. 873, that a foreign corporation which had failed to comply with the constitution and law in regard to designating an agent upon whom process may be served, and filing its articles of incorporation with the county recorder and secretary of state, cannot maintain an action on a contract made prior to their compliance with the law, and for that reason the California citations are not in point, as a compliance with the law, after an action is commenced, would not remove the disability in this state as it does under the California statute.

The case of Phillips v. Goldtree, 74 Cal. 151, 13 Pac. 313, 15 Pac. 451, involves the failure of a partnership to file a •certificate of partnership as provided by the Civil Code of California, sections 2466 and 2468, which sections attach a legal incapacity to maintain an action upon a contract made or a transaction had in the partnership name, on a failure to file such certificate, and the court there held that the objection that no such certificate had been filed must be taken by answer; otherwise, under the provisions of the Code of Civil Procedure, section 434, it was waived.

In the case of Southern Pac. Ry. Co. v. Pursell, supra, which was a case under section 299 of the Civil Code of California, above referred to, the court held that the noneomplianee of the railway corporation to file its articles of incorporation should be raised by answer, and unless specifically set up therein, want of proof of noncompliance with that law was not fatal to the verdict.

In the ease of Wetzel & T. Ry. Co. v. Tennis Bros. Co., supra, decided by the supreme court of West Virginia, it was there held under the provisions of the code of that state, providing that a foreign corporation not having complied with the laws of the state shall not be entitled to maintain any action in the courts of that state, that the failure of a foreign corporation, plaintiff, to so qualify may be pleaded in abatement in any action, suit or proceeding. The court held that such failure was a matter which the defendant was entitled to raise or waive- at its election.

In Dahl v. Montana Copper Co., 132 U. S. 264, 33 L. ed. 325, 10 Sup. Ct. Rep. 97, which is a case from the supreme court of Montana, taken by writ of error to the supreme court of the United States, the plaintiff alleged in its complaint that it was a corporation created under the laws of the state of New York, doing business in Silver Bow county, in the territory of Montana. It will be observed that that allegation is very much like the allegation of the complaint in this case in regard to the corporate capacity of the plaintiff. In that case the answer of the defendant did not deny the incorporation of the plaintiff or its right to do business in Silver Bow county, but only its ownership of the mining claim involved. Justice Field in the opinion in that case stated, among other things, as follows: “No question is therefore raised on the pleadings as to its competency to do business within the territory for want of compliance with the provisions of the territorial law. The question at issue on the pleadings and on the trial in the court below was confined to the ownership of the mining ground. Without, therefore, considering the validity and force of the provisions of thát law, .... or whether, if they are valid, any parties except the government of the territory can allege a disregard of them, to defeat the title of the corporation to its property (Fritts v. Palmer, 132 U. S. 282, 33 L. ed. 317, 10 Sup. Ct. Rep. 93), it is sufficient in this case to say that such incompetency cannot be considered unless set up in the pleadings, in the court below. A failure to comply with the provisions of the law will not be presumed in the absence of any allegation on the subject. The objection cannot be urged for the-first time in this court. ’ ’

As we understand that decision, the supreme court of the-United States holds that the question of noncompliance by a foreign corporation with the laws of the domestic state must be raised by demurrer or answer in the trial court, and cannot be raised for the first time in the appellate court.

In Welsbach Co. v. Norwich Gas and Electric Co., 89 N. V. Supp. 284, 96 App. Div. 52, the court holds, under the general corporation laws of the state of New York providing that no foreign corporation shall maintain an action in the state on any contract made by it in the state, unless it has procured a certificate from the secretary of state entitling it to do business in the state, that the procuring of the certificate is a condition precedent which must be averred in the complaint. In that case, it appeared from the complaint that the plaintiff was within the category of those parties who must procure the certificate before they make the contract in order to sustain an action thereon. The court said: ‘ ‘ The intent that the procurement of such certificate before the contract was made shall be a condition precedent to the maintaining an action thereon, is as plain as any language could make it — certainly as plain as is the language in the Buffalo charter above referred to — and hence, being a condition precedent, it is a fact necessary to be proven, and therefore necessary to be alleged, within the authority of the above case.”

The court quoted from the Beining case as follows: “It is competent for them (the legislature) to attach a condition* to the maintenance of a common-law action, as well as one created by statute; and, when they have done so, its averment and proof cannot safely be omitted.”

It further said: “It is to be noticed that by the amendment of 1901, the enforcement of a contract made by a foreign corporation before it has obtained the required certificate is entirely abrogated. It is made incapable of enforcement because of the omission to procure the certificate before the contract was made. ’ ’'

The demurrer in that case was sustained, and the decision was based' upon the theory that the complaint should have contained an averment that such certificate had been procured before the making of the contracts which were the basis of the action. That decision was by the appellate division of the supreme court of the state of New York, and on appeal the case was taken to the court of appeals. (See Welsbach Co. v. Norwich Gas etc. Co., 180 N. Y. 533, 72 N. E. 1152.) It appears from the short opinion by the appellate court that there were two questions certified to it for decision, to wit: 1. “Was the complaint demurrable on the ground that it appeared upon the face thereof that the plaintiff did not have the legal capacity to sue? 2. Was the complaint demurrable on the ground that facts are not therein stated .sufficient to constitute a cause of action ? ’ ’ Both of said questions were answered in the affirmative by the court of appeals. There the question of the corporation’s capacity to sue was directly raised by the demurrer upon the ground that it appeared upon the face of the complaint that the plaintiff did not have legal capacity to sue.

In the ease of Cumberland Land Co. v. Canter Lumber Co. (Tenn. Ch.), 35 S. W. 886, the court held that a bill by a foreign corporation doing business in the state of Tennessee should be dismissed, it not being alleged that it had complied with the statute as to filing charter and registering abstract of the same. In that case the court said: “With respect to the first error assigned by the defendants, it is proper to state that, in our opinion, it should be sustained. It is true, the point was not made in the court below, nor does it appear in the evidence, that the complainant had failed to file its charter, and have an abstract thereof registered, as required by our statutes. But it 'does appear that it is a foreign corporation, and that it was doing business in this state. This being so, in order to obtain any relief in any of the courts of this state, it was incumbent on complainant to show affirmatively that it had complied with our statutes, on a compliance with which it was alone authorized to do business here. ’ ’

Thus it will be observed that one line of the above-cited authorities holds that noncompliance with the law of the domestic state is a matter of defense to be pleaded affirmatively by the defendant in his answer. The statutes upon which that line of decisions rests are construed by those courts to mean that a failure of a corporation to comply with the statutory conditions upon "which it may enter a state and do business does not operate to render its contracts wholly void, but merely operates to suspend the remedy of such corporation in the courts of the state where such contracts are made until it shall have complied with the statutory conditions. Such are the decisions of California.

The second line of decisions requires the foreign corporation to affirmatively allege and prove its compliance with the statutory requirements of the domestic state, and is based upon a construction of their statutes that makes compliance with the terms thereof a condition precedent to the right to maintain the action in the courts of the domestic state. Other authorities hold, as did the supreme Court of the United States in Dahl v. Montana Copper Co., supra, that the incompetency of a foreign corporation to sue cannot be considered unless set up in the pleadings in the court below, and that a failure to comply with the provisions of the law will not be presumed in the absence of any allegation on the subject, and that objection cannot be first urged in the appellate court. It therefore remains for this state to adopt one or the other line of those authorities as the rule governing such actions in this state.

It is contended by counsel for appellant that this court held in the case of Katz v. Herrick, 12 Idaho, 1, 86 Pac. 873, that contracts of a noncomplying foreign corporation were illegal and void. Counsel evidently misapprehended the effect of that decision. The court there held that the noncomplying foreign corporation had no legal existence in this state, and, under the law, was without a remedy for the enforcement of any contracts made by it within the state, but did not hold that its contracts were absolutely void. In the course of that opinion, the court said: “Courts of equity are always able to protect innocent and honest persons in legitimate transactions, and we are satisfied that the courts of this state can and will protect all persons who have had honest dealings with noncomplying foreign corporations where they deserve protection. ’ ’

The court did not hold in that case that such contracts were absolutely void, but held that such contracts were not enforceable in the courts of this state by a noncomplying corporation. If a foreign corporation fails or neglects to allege in its complaint that it has complied with the laws of this state, in regard to designating an agent upon whom service may be had, and filing its articles of incorporation, it is demurrable on the ground that it fails to allege its legal capacity to sue, for after alleging that it is a foreign corporation, it then places itself in the category of a plaintiff who cannot maintain a suit in this state without alleging that it has complied with the law that must be complied with before such corporation can maintain an action. The failure of a foreign corporation to comply with the law of the state before it may maintain an action goes to its capacity to sue; that is, unless it complies with the law, it has no capacity to sue. A corporation or an individual may have a good cause of action and still have not the capacity to sue; and may have capacity to sue and no cause of action. (Pratt v. Northern Pac. Ry. that it is a foreign corporation and fails to allege its capacity to sue by alleging that it has complied with the law of the state, the complaint is demurrable on the ground of want of legal capacity to sue.

Section 4174 of the Revised Statutes provides seven grounds of demurrer, and the second ground is, “That the plaintiff has not legal capacity to sue. ’ ’ It was evidently intended by the legislature that the specific grounds of demurrer to a complaint must be stated in the demurrer. The ■ only ground of demurrer stated in the demurrer to this complaint is the failure to allege facts sufficient to constitute a .cause of action, which is the sixth ground of demurrer provided in said section 4174. Under that ground of demurrer neither of the other specific grounds of demurrer can be considered. Suffice it to say in this case that neither the demurrer nor the answer raised the question of the want of the respondent’s capacity to sue. That question might have been raised by either demurrer or answer. Section 4175 declares that the demurrer must distinctly specify the grounds on which any of the objections to the complaint are taken, and that unless it does so, the demurrer must be disregarded. Section 4177 provides that whenever any of the matters enumerated in section 4174 do not appear on the face of the complaint, the objection may be taken by answer. Thus, under the law of this state, the question of the want of capacity of the respondent to sue could have been raised by demurrer or answer. That being true, and the appellants having failed to raise the question, we think that they have waived it.

Section 4178 provides that if no objection is taken either by demurrer or answer, the defendant must be deemed to have waived the same, excepting only to the jurisdiction of the court and the objection that the complaint does not state facts sufficient to constitute a cause of action. We are therefore of the opinion that where objections may be taken to allegations of the complaint by either demurrer or answer, if they are not so taken, they are waived as provided in said section 4178.

We therefore hold with that line of authorities which holds that unless the fact of the compliance of a foreign corporation with our state law is put in issue by a demurrer to the complaint, or by answer, it is waived. In the case at bar, the only ground stated in the demurrer was that the complaint did not state facts sufficient to constitute a cause of action. It therefore did not raise 'the question of the capacity of the respondent to sue, and that question was not raised by the answer, and was therefore waived. We therefore hold that the question of the capacity of the respondent to sue was waived on the trial, and that it is too late to raise it on appeal.

From the foregoing we conclude that the judgment of the lower court must be sustained, and it is so ordered, with costs in favor of the respondent.

Ailshie, C. J., concurs.

(January 22, 1908.)

(Syllabus on petition for rehearing.)

1. Where a defendant seeks to defeat the plaintiff’s right of recovery in an action to foreclose a mechanic’s lien by showing that the material was furnished on two separate and distinct contracts, and that the lien was therefore not filed in time to secure the claim for the material furnished on the first contract, the burden of proof is on the defendant to show either that the plaintiff had actual notice that the material was furnished and used on two separate contracts, or else show such circumstances as would impute to plaintiff constructive notice and put him on his inquiry to ascertain that two or more contracts did in fact exist.

ON PETITION FOR REHEARING.

AILSHIE, C. J.

Appellants have filed a petition for rehearing, and insist that since the court in the original opinion held that there was no evidence in the record to support the finding made by the trial court to the effect that the house and porch were constructed under one and the same contract, the findings are therefore necessarily rendered insufficient to support the judgment. In order for-the plaintiff to recover, it was necessary for it to establish that it furnished the material to the contractor under one continuous contract with him, and that the lien was filed within the statutory time after furnishing the material. It is possible for this to be true, and still two or more contracts to have been made and to have existed between the owner of the building and the contractor or builder. Now, in so far as this finding has reference to the contract or contracts between the owner of the premises and the contractor, it is not supported by the evidence, for the reason that the evidence clearly shows that there was one contract for the main building and another and separate contract foB the porch. On the other hand, in so far as the finding had reference to the contract between the builder and the company furnishing the material, we hold that the finding is supported by the evidence. In this view of the case the findings are still sufficient to support the judgment.

But the appellants insist that as soon as they succeeded in establishing the fact that the material furnished was used by the contractor upon two separate and distinct contracts which he had with the owner of the building and premises, they then shifted the burden of showing want of knowledge that two separate contracts existed on to the materialman, the respondent in this case. We do not think that would be a correct view to take of the law or the proper practice to adopt. When the plaintiff, who is seeking to foreclose his lien, establishes the fact that he furnished the material to the contractor under one arrangement and contract with him, and has presented sufficient evidence to make his case on that theory, then if the defendant seeks to defeat the right of recovery on the ground that there were two separate and distinct contracts, after showing their existence, he should be required to either show that the materialman had actual knowledge that two contracts existed, or else prove such facts and circumstances either by way of lapse of time, cessation of work, occupation of the building and premises by the owner, settlement of accounts, or other circumstances that would amount to constructive notice to the materialman and put him on his inquiry to ascertain that two contracts did in fact exist. In this case, as said in the original opinion, there are a number of circumstances which tend to show that the plaintiff had notice of the completion of the original contract, and that aiiother contract had been entered into between the owner and the builder; but the court found in substance against the appellants’ contention and in favor of the respondent, and we would not be justified, under the evidence as disclosed in interfering with that finding.

Appellants urge that they ought to be granted a new trial in order to enable them to establish the fact that the lumber (jompany had actual notice of the completion of the contract and the making of the second contract. We are unable, however, to find anything in the record that would justify us in doing so. The court seems to have admitted all the evidence that appellants offered tending to establish the fact that .the company had notice. There is nothing in the record which indicates or tends to indicate that the’ appellants could make any stronger case on that issue than they have already made. We do not find anything in the petition which changes our view of the case or that would justify us in granting a rehearing. The petition is denied.

Sullivan, J., concurs.  