
20 Cal.App.2d 332 (1937)
JOHN HOLM, Appellant,
v.
C. H. BRAMWELL, Respondent.
California Court of Appeals. 
April 13, 1937.
 Charles T. Rippy and Dana R. Weller for Appellant.
 C. Roy Smith and Stacy H. Aspey for Respondent.
 Thompson, J.
 The plaintiff, a licensed building contractor, has appealed from a judgment of foreclosure of a mechanic's lien which was rendered in his favor to secure the payment of $2,441.92 and interest. The court disallowed his claim to the extent of $1108.63, which amount he voluntarily paid to a subcontractor pursuant to an agreement which was held to be illegal for the reason that the sub-contractor was not licensed as required by the Statutes of 1929. (Stats. 1929, p. 1591, 1 Deering's Gen. Laws of Calif. of 1931, p. 722, Act 1660.) The appellant contends this item should have been allowed.
 C. H. Bramwell, a resident of Chicago, is the owner of five contiguous lots in Los Angeles. He made a contract with the plaintiff, Holm, to construct buildings on those lots, in compensation for which he agreed to pay plaintiff the cost thereof, plus ten per cent. Holm was a duly licensed contractor. Holm employed George Collins, who was not a licensed subcontractor, to furnish certain materials and perform certain labor upon the buildings, for which Holm paid him the sum of $1108.63, no part of which has been refunded. Collins bid for and received from Holm a contract for the brick work February 4, 1934. He was not then licensed. On February 23, 1934, before the labor was performed by Collins, a contractor's license was issued to "Mrs. George Collins & Company", which was found to be a copartnership of which George Collins was a member. The buildings were completed at a total cost of $8,962.62. The owner paid Holm $6,159.40 of that sum. A balance of $3,699.48 remained unpaid. The owner, contending that the cost of the buildings was excessive, refused to pay Holm the balance on the theory that he had awarded certain contracts for materials and labor to an unlicensed subcontractor, which was contrary to law and invalid. The plaintiff then brought this suit to establish a mechanic's lien on the property and to sell it to satisfy the unpaid balance of $3,699.48. The court adopted findings favorable to the plaintiff in every respect, except that it was *334 found that the claim, to the extent of $1108.63, was founded on an illegal contract which Holm had made with an unlicensed subcontractor contrary to law, and that it was therefore void. Judgment was accordingly rendered for the plaintiff for the sum of $2,441.92, for the payment of which a lien was established. It is conceded that the court found and that the plaintiff is entitled to judgment for the additional sum represented by 7 per cent interest on $2,441.92 from September 11, 1934, which item for interest was not included in the judgment. The court, however, disallowed the item of $1108.63, as illegal, finding that the subcontract therefor was contrary to law and void. From that judgment the plaintiff has appealed.
 [1] We are of the opinion the plaintiff's contract with the unlicensed subcontractor is illegal and void and that the court properly disallowed those items in the aggregate sum of $1108.63 and properly refused to vest a lien upon the property for the payment of that sum.
 Mechanics' liens are creatures of statute and therefore dependent upon at least substantial compliance with the law. Numerous authorities support the text which is found in 17 California Jurisprudence, page 81, section 50, as follows:
 "Mechanics' liens are entirely of statutory creation, and the statute must be looked to both for the right to the lien and the mode by which it can be enforced. The right to a mechanic's lien depends upon a compliance with the statute, and in order that a valid lien may arise and be enforced, the claimant must strictly, or at least substantially, observe and comply with the provisions of the statute, none of which may be regarded as unessential."
 This is not a suit by a materialman or laborer to recover a claim for services performed or materials furnished to the owner of property upon the basis of a quantum meruit. It is a suit to recover money paid pursuant to an illegal contract with a subcontractor which is void. A mechanic's lien may not be founded on an illegal contract procured contrary to law.
 That portion of the Contractors' License Law which is applicable to this cause provides as follows:
 "Section 1. ... It shall be unlawful for any person ... copartnership ... or other organization ... to engage in the business or act in the capacity of a contractor within *335 this state without having a license therefor as herein provided ..."
 "Section 3. ... A contractor within the meaning of this act is a person ... copartnership ... or other organization ... who, in any capacity other than as an employee ... undertakes or offers to undertake or purports to have the capacity to undertake or submits a bid, to construct ... any building ... or other structure, project, development or improvement, or any part thereof ... provided, however, that the term contractor as used in this act shall include subcontructors ..."
 "Section 12. Any person who acts in the capacity of a contractor within the meaning of this act without a license as herein provided, and any person who conspired with another person to violate any of the provisions of this act is guilty of a misdemeanor ..."
 It will be observed the act requiring a license to be procured applies to a subcontractor as well as to a contractor. Section 3 of the act defines a contractor or a subcontractor as a person, copartnership or corporation who "undertakes or offers to undertake or purports to have the capacity to undertake or submits a bid to construct ... any building". Since the act applies specifically to a subcontractor it is illegal for one to contract with him or to consider a bid for the construction of any part of a building, unless he is licensed according to law.
 The contract between the plaintiff and his subcontractor, who was not licensed as required by law, was illegal and void. (Stockton Plumbing & Supply Co. v. Wheeler, 68 Cal.App. 592, 601 [229 P. 1020]; Southlands Co. v. City of San Diego, 211 Cal. 646, 658 [297 P. 521]; Firpo v. Murphy, 72 Cal.App. 249 [236 P. 968]; City of Los Angeles v. Watterson, 8 Cal.App.2d 331, 346 [48 PaCal.2d 87]; 2 Restatement of the Law of Contracts, p. 1087, sec. 580.)
 Assuming, without so deciding, that a contract with a duly licensed copartnership would be valid, even though it were inadvertently made in the name of an individual member of that copartnership, the subcontract upon which the plaintiff relies was made with Collins before the partnership was licensed. The evidence is uncontradicted that the partnership of "Mrs. Geo. Collins and Company", of which George Collins was a member, was not licensed when the bid was accepted or until after the contract for the brick *336 work was awarded to him. It may, therefore, not be said the plaintiff contracted for that work with a licensed subcontractor.
 It is true the Contractors' License Law does not specifically provide that a contract in violation thereof shall be void. But section 12 does specifically provide that:
 "Any person, who acts in the capacity of a contractor [or subcontractor] within the meaning of this act without a license as herein provided, ... is guilty of a misdemeanor", and shall be punished by a fine or imprisonment as described therein.
 The same section further provides that:
 "No person engaged in the business or acting in the capacity of a contractor [or subcontractor] as defined by section 3 of this act shall bring or maintain any action in any court of this state for the collection of compensation for the performance of any act for which a license is required by this act, without alleging and proving that such person was a duly licensed contractor at the time the alleged cause of action arose."
 It has been repeatedly held that a party to an illegal contract may not rest his cause, or recover judgment based upon such void agreement. In Wise v. Radis, 74 Cal.App. 765 [242 P. 90], it is said at page 775 thereof:
 "No principal of law is better settled than that a party to an illegal contract or an illegal transaction cannot come into a court of law and ask it to carry out the illegal contract or to enforce rights arising out of the illegal transaction. He cannot set up a case in which he necessarily must disclose the illegal contract or the illegal transaction as the basis of his claim. In Moore v. Moore, 130 Cal. 110 [80 Am.St.Rep. 78, 62 P. 294], our Supreme Court quotes Judge Duncan in Swan v. Scott, 11 Serg. & R. (Pa.) 164, as follows: 'The test whether a demand connected with an illegal transaction is capable of being enforced is whether the plaintiff requires the aid of the illegal transaction to establish his case. If the plaintiff cannot establish his case without showing that he has broken the law, the court will not assist him, whatever his claim in justice may be upon the defendant.'"
 In the case of Firpo v. Murphy, supra, it is said, with respect to the illegality of a contract enacted under a statute which is intended to protect the public against imposition: *337
 "While there is no express declaration in these sections that the transactions condemned are unlawful, or that no recovery shall be had thereon in the event that the provisions are violated, still it has been held that they, being designed for the protection of the public, and a penalty prescribed for a violation thereof, that such penalty is the equivalent of an express prohibition, and that a contract made contrary to the terms thereof is void, and further that whenever the illegality appears, whether the evidence comes from one side or the other, the disclosure is fatal to the case."
 There are certain cases in which a recovery may be authorized in spite of an illegal contract, when the action is not founded on the illegal contract, but when on the contrary it is based upon a subsequent legal contract or agreement which may be established without reference to the illegal contract.
 In the present case, the plaintiff is clearly not entitled to recover a lien to secure the repayment of money which he advanced to George Collins pursuant to an illegal contract, for the reason that this suit is based upon that illegal contract and the claim cannot be established except by reference to the price fixed by the illegal contract. The present case, therefore, does not come within the exception to the general rule, above mentioned.
 The contract between the plaintiff and the subcontractor, Collins, being illegal and void, the advances alleged to have been paid to Collins are not recoverable in this suit for the reason that they must be deemed to have been voluntarily made. (Myers v. City of Calipatria, 140 Cal.App. 295, 299 [35 PaCal.2d 377]; Metropolitan Casualty Ins. Co. v. Stone, 124 Cal.App. 430, 438 [12 PaCal.2d 665].) In the Myers case, supra, it is said in that regard:
 "'It is the compulsion or coercion under which the party is supposed to act which gives him a right to relief. If he voluntarily pay an illegal demand, knowing it to be illegal, he is of course entitled to no consideration; and if he voluntarily pay such demand in ignorance or misapprehension of the law respecting its validity, he is in no better position, for it would be against the highest policy to permit transactions to be opened upon grounds of this character.'"
 We find nothing in the authorities cited by the appellant in conflict with what we have heretofore said. The case of *338 Hunt v. Douglas Lumber Co., 41 Ariz. 276 [17 PaCal.2d 815], upon which the appellant chiefly relies, may be readily distinguished from the present case. In the present case the general contractor seeks to recover money he paid to his own subcontractor under his agreement with the subcontractor who was not qualified to make a valid contract because he was unlicensed. It was the duty of the contractor to ascertain whether the subcontractor with whom he proposed to deal was licensed. The contractor was bound to know that the law requires all contractors and subcontractors to be licensed. The contractor was a party to the illegal subcontract under which he seeks to recover. This case does not present circumstances like the Hunt case, in which a materialman, in good faith, furnished lumber to one whom he was led to believe was the agent of the owner of the building. In the Hunt case the Douglas Lumber Company brought suit against Hunt, the owner of the building, and Estes, his contractor, to recover the reasonable value of lumber which it furnished at the request of the contractor, believing that he ordered the lumber as the agent of Hunt, and not as a mere contractor. That case was not based on the illegal contract. It was not a suit to recover the value of labor or materials furnished pursuant to the contract. It was not a suit by the contractor, nor was it decided on the theory that the lumber was furnished to the contractor. On the contrary, that case was decided on the theory that the lumber was sold to the owner of the building through Estes as his agent. The court says in that regard:
 "We have then the following situation: Defendant (the owner) had authorized Estes, (the contractor) to proceed with the improvements on his premises and plaintiff (Douglas Lumber Co.) had knowledge of that fact. It had no knowledge that, as a matter of law, the contract apparently existing between defendant and Estes, and which, if it did exist, made Estes the agent of defendant for the purpose of fixing a lien, was void. Under these circumstances the situation was that frequently existing where the relation of principal and agent is involved. Where A by his conduct leads B to believe C is A's agent, the latter is estopped from denying the agency. ... We think defendant herein is estopped so far as plaintiff is concerned from denying the existence of a valid contract, and therefore a statutory agency, between himself and Estes." *339
 No such situation exists in the present case. No question of agency is here involved. The Hunt case is not in point.
 It is conceded the plaintiff is entitled to judgment according to the findings which were adopted for interest on the sum of $2,441.92 at the rate of 7 per cent per annum from September 11, 1934.
 The court is directed to ascertain the amount of interest due according to the findings and allow that sum as a part of the judgment. As so modified, the judgment is affirmed, respondent to recover costs on appeal.
 Plummer, J., and Pullen, J., concurred.
