
46 Cal.2d 450 (1956)
R. T. TIEDJE, Appellant,
v.
ALUMINUM TAPER MILLING COMPANY, INC. (a Corporation) et al., Respondents.
L. A. No. 24088. 
Supreme Court of California. In Bank.  
May 4, 1956.
 Lech T. Niemo and William R. Law for Appellant.
 Alan H. Cassman and Edmund I. Read for Respondents.
 SPENCE, J.
 Plaintiff appeals from a judgment of dismissal entered upon the sustaining of demurrers to his third amended complaint without leave to amend. Said amended complaint contains three counts: (1) for declaratory relief; (2) to quiet title; and (3) for voiding an illegal sale of stock. [1] However, these counts rely upon the same facts as the basis for plaintiff's claimed right to recover certain corporate stock and accordingly, they will be treated as one. (Stephan v. Obersmith, 48 Cal.App.2d 199, 202 [119 P.2d 388]; also Ephraim v. Metropolitan Trust Co., 28 Cal.2d 824, 833 [172 P.2d 501].) Both general and special demurrers were interposed. [2] But in view of the denial of leave to amend, the grounds of special demurrer need not be considered here, for the determinative question is the sufficiency of plaintiff's complaint against general demurrer. (Maguire v. Hibernia Sav. & Loan Soc., 23 Cal.2d 719, 737 [146 P.2d 673, 151 A.L.R. 1062]; Columbia Pictures Corp. v. DeToth, 26 Cal.2d 753, 762 [161 P.2d 217, 162 A.L.R. 747].) Plaintiff properly maintains that the allegations of his third amended complaint are sufficient against the general demurrer, and the trial court therefore erred in its ruling.
 Plaintiff alleges that defendant Aluminum Taper Milling Company, Inc., is a California corporation and he was the *453 owner of 2,500 shares of its stock; that on September 30, 1953, he agreed with the corporation to sell his shares to it for $25,000, plus an Oldsmobile automobile which they valued at $4,000, and that there was no other consideration; that he received the money and automobile and delivered the stock to the corporation on that day, September 30, 1953; that the purchase of the stock by the corporation was a violation of Corporations Code, sections 1705- 1708, in that it was purchased "with the capital assets and from the stated capital" rather than "from earned surplus," and it did not come within any of the permitted transactions listed in those sections; that he "did not know that the said defendant corporation at the time he entered into said purported agreement, was not purchasing the said stock out of earned surplus, but that it was, on the contrary, purchasing the said shares in violation of the express provisions of the Corporation Code as stated hereinabove"; and that the agreement for sale and purchase of the stock, in not meeting the aforementioned statutory requirements, is therefore "void and a nullity." Plaintiff prays for declaratory relief, a decree quieting title, and for restoration of possession of the shares upon condition that he return the sum paid him for the stock with appropriate interest thereon.
 [3] It is the theory of the California corporation law (Corp. Code,  1705-1708) that as "a general rule the purchase by a corporation of its own shares should not be allowed except out of earned surplus which would be available for distribution as cash dividends." (Ballantine & Sterling on California Corporation Laws, 1949 ed.,  152, p. 211.) [4] The allegations of plaintiff's complaint are sufficient to show that the purchase here did not come within any of the authorized exceptions to the general rule; and accordingly, such allegations support the conclusional averment of invalidity of the transaction. (Smith v. Bach, 183 Cal. 259, 262 [191 P. 14]; Mindenberg v. Carmel Film Productions, Inc., 132 Cal.App.2d 598, 607 [282 P.2d 1024].) [5] Ordinarily, a party to an illegal contract can neither recover damages for breach nor, by rescinding, recover the performance that he has rendered or its value. (Owens v. Haslett, 98 Cal.App.2d 829, 833 [221 P.2d 252]; Fong v. Miller, 105 Cal.App.2d 411, 413 [233 P.2d 606].) [6] A contract made contrary to public policy or against the express mandate of a statute may not serve as the foundation of any *454 action, either in law or in equity (Hooper v. Barranti, 81 Cal.App.2d 570, 574 [184 P.2d 688]), and the parties will be left, therefore, where they are found when they come to a court for relief. (Brooks v. Brooks, 63 Cal.App.2d 671, 676 [147 P.2d 417].) These principles are not applied to secure justice between the parties, but from regard for a higher interest--that of the public, whose welfare demands that certain transactions be discouraged. (Franklin v. Nat C. Goldstone Agency, 33 Cal.2d 628, 632 [204 P.2d 37].)
 However, to these settled rules there are certain recognized exceptions in favor of a party who is not in pari delicto with the other party to the contract, and who as the more innocent of the two, seeks recovery. [7] One of these exceptions is "where the illegality of a bargain is due to facts of which one party is justifiably ignorant and the other party is not." (Rest., Contracts,  599 (a); also 12 Cal.Jur.2d  104, p. 304.) This exception was applied in Hardy v. Musicraft Records, Inc., 93 Cal.App.2d 698 [209 P.2d 839], where defendant, the seller, failed to comply with the Corporate Securities Act requiring a permit to sell securities and plaintiffs, the buyers, were allowed to recover the amount paid. In so holding, the court stated at page 703: "It was the duty of the corporation to procure a permit. No obligation rested on the buyers to ascertain whether or not a permit has been issued. They had a right to assume that the corporation had complied with the law before offering its securities for sale."
 Plaintiff here seeks to bring himself within this exception by alleging that at the time he entered into the agreement with defendant company, he "did not know that [it] ... was not purchasing the said stock out of earned surplus, but that it was, on the contrary, purchasing the said shares in violation of the" governing statutory law. [8] For the purposes of demurrer, this allegation must be accepted as true. (Brotemarkle v. Snyder, 99 Cal.App.2d 388, 390 [221 P.2d 992].) [9] It thus becomes a matter of proof as to whether plaintiff and defendant company were equally guilty (Hardy v. Musicraft Records, Inc., supra, 93 Cal.App.2d 698, 703), and plaintiff should have his day in court to prove his allegations. (Owens v. Haslett, supra, 98 Cal.App.2d 829, 834-835.) [10a] While plaintiff is chargeable with knowledge of the law prohibiting the transaction in question (Stevens v. Boyes Hot Springs Co., 113 Cal.App. 479, 483 [298 P. 508]), his pleading of lack of knowledge of the facts which would bring that law into operation presents an issue of *455 fact which must be determined upon the trial of that issue rather than upon demurrer.
 [11] It is clear that plaintiff does not occupy the position of one who belongs to a class for whose protection the statute was enacted. (Pollak v. Staunton, 210 Cal. 656, 662-663 [293 P. 26]; Carter v. Seaboard Finance Co., 33 Cal.2d 564, 574 [203 P.2d 758]; see Ballantine & Sterling on California Corporation Laws, 1949 ed.,  166, p. 227.) Corporations Code, section 1715, provides that any shareholder who makes a sale of stock to the corporation "with knowledge of facts indicating the impropriety of the purchase is liable to the corporation ... to the extent of the payments received therefor, with interest thereon at 7 per cent a year until paid." Such provision indicates that the restriction on the corporation's purchase of its own shares was enacted for the benefit of the corporation as a whole, its creditors and stockholders other than the participating stockholder. [10b] But there still remains the question of plaintiff's right to relief despite the illegality of the transaction, because of his asserted lack of knowledge of the facts which made defendant company's purchase of his stock a violation of the law. Plaintiff is not asking the court to carry out an illegal contract or to enforce rights arising out of the illegal transaction (Wise v. Radis, 74 Cal.App. 765 [242 P. 90]), but he is seeking relief from a contract which was illegally made. Under these circumstances, the allegation concerning his lack of knowledge of the facts which made defendant company's purchase of his stock a violation of the law presents a material allegation of fact. [12] Where there is no parity of delictum, one party having no duty under the law and having the right to assume that the other party, who has a duty, has complied with the law may resort to the courts though the illegal transaction has been completed. (Hardy v. Musicraft Records, Inc., supra, 93 Cal.App.2d 698.)
 [13] The conclusion that plaintiff's third amended complaint is not vulnerable to general demurrer does not mean that it is not subject to special demurrer. In sustaining the demurrers to plaintiff's said amended complaint, the trial court did not indicate upon what ground it based its ruling. Upon the remanding of the cause, the trial court may in its discretion require the clarification of such uncertainties or ambiguities as may exist in plaintiff's third amended complaint (Maguire v. Hibernia Sav. & Loan Soc., supra, 23 Cal.2d *456 719, 737; Columbia Pictures Corp. v. DeToth, supra, 26 Cal.2d 753, 762) as well as the explanation or correction of such discrepancies as may appear material because of allegations contained in plaintiff's superseded pleadings. (Wennerholm v. Stanford University School of Medicine, 20 Cal.2d 713, 716 [128 P.2d 522, 141 A.L.R. 1358]; Jackson v. Pacific Gas & Electric Co., 95 Cal.App.2d 204, 211-212 [212 P.2d 591].)
 The judgment is reversed.
 Gibson, C.J., Shenk, J., Carter, J., Traynor, J., Schauer, J., and Dooling, J., pro tem.,  [fn. *] concurred.
NOTES
[fn. *]  *. Assigned by Chairman of Judicial Council.
