
246 Cal.App.2d 578 (1966)
BANK OF AMERICA, as Executor, etc., Plaintiff and Appellant,
v.
DEPARTMENT OF MENTAL HYGIENE, Defendant and Respondent.
Civ. No. 23583. 
California Court of Appeals. First Dist., Div. Three.  
Nov. 21, 1966.
 J. A. Pardini, Elda Granelli and Julian Pardini for Plaintiff and Appellant.
 Thomas C. Lynch, Attorney General, and Elizabeth Palmer, Deputy Attorney General, for Defendant and Respondent.
 BRAY, J.  [fn. *]
 Plaintiff Bank of America as executor of the last will and testament of Francesco Cerruti, deceased, appeals from judgment in favor of defendant Department of Mental Hygiene of the State of California after demurrer to complaint sustained without leave to amend.
 Questions Presented
 1. May the court on the hearing of the demurrer take judicial notice of the decree settling first and final account and of distribution in Francesco's estate?
 2. If so, is the decree res judicata of the subject matter of this action?
 3. The effect of the dismissal with prejudice of the prior action.
 4. Does a cause of action lie for recovery of money paid to the state under a statute held prior to payment to be constitutional but subsequently declared to be unconstitutional?
 5. Does section 905.2 of the Government Code apply?
 6. Applicability of Department of Mental Hygiene v. Kirchner (1964) 60 Cal.2d 716 [36 Cal.Rptr. 488, 388 P.2d 720].
 Record
 This being a judgment based upon the sustaining of a demurrer to the complaint without leave to amend, the facts stated in the complaint must be accepted as true. Plaintiff is the executor of the last will of Francesco Cerruti, who died in 1961. His daughter, Albina, was committed to Napa State Hospital in 1954 as a mentally ill person. In August, 1962, defendant department, pursuant to section 6650 of Welfare and Institutions Code, brought an action in San Francisco Superior Court against plaintiff to recover $8,069.48 for Albina's care. Judgment of dismissal in favor of the bank was appealed and in Department of Mental Hygiene v. Bank of America (1963) 220 Cal.App.2d 160 [33 Cal.Rptr. 566], was *581 reversed. Petition for hearing in the Supreme Court was denied. Thereafter the claim was settled for $5,676.19, which amount was paid by plaintiff executor on December 3, 1963. On January 31, 1964, the California Supreme Court in Kirchner held section 6650 unconstitutional. On March 31, 1964, plaintiff filed a claim with the State Board of Control to recover the money. The claim was rejected. Thereupon, on October 26, 1965, plaintiff filed this action to recover the amount paid. Defendant's general demurrer to the complaint was sustained without leave to amend.
 1. Judicial Notice of the Probate Decree.
 [1] Defendant contends that that decree is res judicata of the subject matter of the complaint herein.
 On February 19, 1964, the decree settling the first and final account of plaintiff herein and decree of final distribution in Francesco's estate was entered. The executor's payment in settlement of the defendant's claim was approved therein.
 At one time there was a wide split in the cases as to the use of judicial notice when ruling upon a demurrer where the judgment did not appear on the face of the complaint. (See, for example, Pike v. Archibald (1953) 118 Cal.App.2d 114 [257 P.2d 480]; Garcia v. Garcia (1957) 148 Cal.App.2d 147 [306 P.2d 80]; Willson v. Security-First Nat. Bank (1943) 21 Cal.2d 705 [134 P.2d 800].) However, the matter is now settled by Flores v. Arroyo (1961) 56 Cal.2d 492, 496 [15 Cal.Rptr. 87, 364 P.2d 263], where the court held that in ruling on a demurrer essentially founded on res judicata, the court may take judicial notice of a prior judgment in a different case though such judgment or its content is not pleaded in the complaint, provided (a) the judgment is appropriately drawn to the court's attention and (b) the plaintiff has adequate notice and opportunity to be heard on the question of the effect of such judgment.  [fn. 1] The court expressly stated that any statements in the decisions of its court or of the Courts of Appeal contrary to the rule announced in Flores were overruled and disapproved (p. 497).
 The trial court having had the right to take judicial notice of said decree and having done so, we turn to the question: *582
 2. Is the decree res judicata of the subject matter of this action?
 [2] "A former judgment operates as a bar against a second action upon the same cause, but in a later action upon a different claim or cause of action, it operates as an estoppel or conclusive adjudication as to such issues in the second action as were actually litigated and determined in the first action." (Zaragosa v. Craven (1949) 33 Cal.2d 315, 321 [202 P.2d 73, 6 A.L.R.2d 461].)
 The decree adjudged, in effect, that the claim of the department was a proper charge against the estate and its payment a proper one. [3] "A decree of distribution which has become final is as conclusive and final as any other judgment entered by a court of competent jurisdiction. ..." (Estate of Bodger (1955) 130 Cal.App.2d 416, 418 [279 P.2d 6]; Estate of Green (1955) 138 Cal.App.2d 211 [292 P.2d 651].)
 [4] "[T]he application of the principle of res judicata in a given case depends upon an affirmative answer to these three questions: Was the issue decided in the prior adjudication identical with the one presented in the subsequent litigation? Was there a final judgment on the merits? Was the party against whom the principle is invoked a party or in privity with a party to the prior adjudication? (Bernhard v. Bank of America, 19 Cal.2d 807, 813 [122 P.2d 892].)" (Dillard v. McKnight (1949) 34 Cal.2d 209, 214 [209 P.2d 387, 11 A.L.R.2d 835].)
 The issue decided by the decree is identical with the one presented in the case at bench, namely, the validity of the department's claim against Francesco's estate for Albina's care. The decree was a final judgment on the merits. The executor had the authority to make the settlement, even without a prior authorization from the court. (See Estate of Lucas (1943) 23 Cal.2d 454, 464 [144 P.2d 340].) The decree approving the payment was entered February 19, 1964. It was appealable. (Prob. Code,  1240; Estate of Cole (1951) 106 Cal.App.2d 823, 825 [236 P.2d 206].) No appeal was taken, so the decree became final in 60 days. (Cal. Rules of Court, rule 2(a).) Kirchner was decided January 30, 1964, some 20 days before the decree was entered and some 80 days before the time to appeal expired. So plaintiff executor could have raised the question of the application of Kirchner to defendant's claim.
 The party against whom the res judicata principle is *583 invoked in the case at bench, Francesco's estate, is the same party as the one in the prior adjudication.
 3. Dismissal With Prejudice.
 [5a] Somewhat akin to the fact that the decree in Francesco's estate is res judicata in this action, is the situation with reference to the effect of the dismissal with prejudice of the action brought by defendant against plaintiff on its claim. On December 10, 1963, there was filed in that action "Dismissal With Prejudice" signed by counsel for both parties. This recited in pertinent part "the above-entitled action having been compromised and settled, the same is hereby dismissed with prejudice."
 [6] It is well settled that a dismissal with prejudice by consent or stipulation of the parties, after compromise or settlement of the suit where the dismissal is intended to operate as a retraxit and end the litigation, is a bar to a subsequent suit. (See Sears v. De Mota (1958) 157 Cal.App.2d 216, 220 [320 P.2d 579]; Goddard v. Security Title Ins. & Guar. Co. (1939) 14 Cal.2d 47, 55 [92 P.2d 804].) Undoubtedly under this rule it would appear that the litigation is ended not only as to the plaintiff's cause of action but also as to any defense the defendant could have set up; otherwise there would be no "end to the litigation" which is the object of a dismissal with prejudice.
 [5b] Plaintiff contends that the above rule does not apply to a situation where the judgment is obtained under a statute which has been declared constitutional but thereafter is declared unconstitutional. It cites four cases in support of its contention, none of which are in point. One is Olivera v. Grace (1942) 19 Cal.2d 570 [122 P.2d 564, 140 A.L.R. 1328], in which the plaintiff brought an action to set aside a judgment against a person known to the plaintiff who obtained the judgment to be incompetent at the time. The reviewing court reversed the judgment based upon the sustaining of a demurrer without leave to amend, holding that the complaint stated a cause of action upon the ground of fraud. The question of validity of any statute was not involved.
 The second case is Stetson & Co. v. Goldsmith (1858) 31 Ala. 649, an action to obtain an injunction to restrain the enforcement of a judgment for damages for a trespass. Stetson had brought suit against Goldsmith. In that action a writ of attachment was issued by the clerk of the city court, and *584 under it a stock of goods belonging to Goldsmith was sold. It had been the custom for the city court clerk to issue such writs, and just prior to the issuance of this writ the city court in another action had held that the clerk had such authority. That ruling, however, was on appeal at the time of the issuance of the writ in question. The Supreme Court thereafter reversed the city court, holding that the clerk did not have such authority. Thereupon Goldsmith sued Stetson for trespass and obtained a $5,000 judgment. The trespass consisted of the levy on the Goldsmith stock of goods under the writ of attachment issued by the clerk. Thereupon Stetson brought the action in 31 Alabama to enjoin the enforcement of that judgment. The trial court made an interlocutory decree ordering a preliminary injunction which had restrained the operation of the $5,000 judgment to be dismissed, unless within five days Stetson pay that judgment less the amount of Stetson's judgment against Goldsmith but requiring Goldsmith to file a refunding bond to await the outcome of the action. On appeal the Supreme Court affirmed the trial court's holding that Stetson had not been injured by the decree. It further held, in effect, that Stetson had committed a trespass in levying upon Goldsmith's goods a writ of attachment which the clerk's lack of authority to issue was determined after the issuance of the writ.
 The third case is Miller v. Hall (1854) 12 Tex. 556. There the appellant recovered judgment against the appellee before a justice of the peace. He obtained a writ of certiorari from the clerk of the district court, under a statute which provided for the issuance of such a writ by the clerk. Thereafter the statute was declared unconstitutional and the district court refused to consider certiorari as only the court could issue the writ. The appellant then petitioned the district court for an injunction to restrain enforcement of the judgment to grant certiorari. That court granted the petition and on review set aside the judgment, granted a new trial before it, and after trial granted a judgment awarding the appellant a less amount than had been awarded by the justice of the peace. The appellant then appealed from the district court's judgment. The Supreme Court reversed the judgment on the ground that the appellant had shown no grounds for the relief granted by the district court. By way of dicta, the point not having been raised, the Supreme Court said that "if the appeal was taken under the authority of an Act of the Legislature which was *585 afterwards determined to be unconstitutional, and it appeared from the petition that the party was not and by reasonable diligence could not have been apprised of this determination until too late to prosecute his ordinary legal remedy" (12 Tex. 557), a court of equity could consider allowing him certiorari affording him a new trial.
 The fourth case is Cobbs v. Coleman (1855) 14 Tex. 594, in which the situation was similar to that in Miller except that the appellant did claim right to relief because of the later determination of the unconstitutionality of the statute authorizing the district court clerk to issue certiorari. The Supreme Court held, on the authority of Miller, supra, that the district court should have granted certiorari and reversed its denial thereof.
 All of those cases dealt with matters of procedure and not with a judgment on the merits obtained by stipulation of the parties.
 4. No Cause of Action.
 [7a] The settlement reached by the parties under which the action brought against the estate was settled and that action dismissed was in reliance upon Department of Mental Hygiene v. McGilvery (1958) 50 Cal.2d 742 [329 P.2d 689], in which the Supreme Court determined that section 6650 of Welfare and Institutions Code was constitutional. Upon somewhat similar issues and facts, that court six years later, in Kirchner, held the same statute unconstitutional in part.
 [8] The rule appears clear in California that a judgment which was contrary to the Constitution because it was based upon a statute later held invalid, is nevertheless res judicata in a subsequent suit. (Pacific Mutual Life Ins. Co. v. McConnell (1955) 44 Cal.2d 715, 726, 727 [285 P.2d 636]; Overstreet v. County of Butte (1962) 57 Cal.2d 504 [20 Cal.Rptr. 631, 370 P.2d 335]; Zeppi v. State of California (1962) 203 Cal.App.2d 386 [21 Cal.Rptr. 534].) In McConnell, supra, the court cited Chicot County Drainage Dist. v. Baxter State Bank, 308 U.S. 371 [84 L.Ed. 329, 60 S.Ct. 317], which is the leading case upholding the principle enunciated in McConnell. Chicot was quoted with approval in Mueller v. Elba Oil Co., 21 Cal.2d 188, 205-206 [130 P.2d 961], and cited in Rescue Army v. Municipal Court, 28 Cal.2d 460, 463-464 [171 P.2d 8]. *586
 [7b] In County of Los Angeles v. Faus (1957) 48 Cal.2d 672, 680-681 [312 P.2d 680], the court said: "It is the general rule that a decision of a court of supreme jurisdiction overruling a former decision is retrospective in its operation and that the effect is not that the former decision was bad law but that it never was the law. A well-recognized exception to this general rule is that, where a constitutional provision or statute has received a given construction by a court of last resort and contracts have been made or property rights acquired under and in accordance with its decision, such contracts will not be invalidated nor will vested rights acquired under the decision be impaired by a change of construction adopted in a subsequent decision. Under those circumstances it has been the rule to give prospective, and not retrospective, effect to the later decision. (7 R.C.L. (1915), Courts,  36, p. 1010.)"
 In Cooley v. County of Calaveras (1898) 121 Cal. 482 [53 P. 1075], the plaintiff justice of the peace had received from the county fees of $3 per criminal case in accordance with an 1895 statute then in effect. Subsequently that statute was declared unconstitutional by the Supreme Court. This left in effect the County Government Act of 1893, which provided that the fees for those services should be $7 per case. The plaintiff then brought suit against the county for the difference. The court stated: "There was no mistake as to the fees plaintiff should receive when his services were rendered. The statute of 1895 fixed their amount and the plaintiff settled upon that basis, and no subsequent decision of a court can create a mistake and annul a previous contract which was legal and valid when made" (p. 485). The court then quoted from Lyon v. Richmond, 2 Johns. Ch. 51: " 'And to permit a subsequent judicial decision in any one case on a point of law to open and annul everything that has been done in other cases of a like kind for years before, under a different understanding of the law, would lead to the most mischievous consequences. Fortunately for the peace and happiness of mankind, no such pernicious precedent is to be found. The case is, therefore, to be decided according to the existing state of things when the settlement in question took place.' " (121 Cal. p. 486.)
 Campbell v. Rainey (1932) 127 Cal.App. 747 [16 P.2d 310], was an action brought by a stockholder in an insolvent bank to recover from the defendant Superintendent of Banks moneys paid on account of an assessment levied by the latter under a *587 statute which after the payment was made was declared unconstitutional by the Supreme Court. In denying recovery the court quoted from Cooley v. County of Calaveras: " 'The understanding of the law prevailing at the time of the settlement of a contract, although erroneous, will govern, and the subsequent settlement of a question of law by judicial decision does not create such a mistake of law as courts will rectify' " (p. 750).
 Plaintiff contends that the exception to the general rule concerning the declaration as unconstitutional of a statute previously declared to be constitutional only applies to cases involving contracts. However, in Campbell, the trial court found that the payment of the stockholder's assessment was made under compulsion and that, therefore, the ruling that the statute by virtue of whose provisions the assessment was levied was unconstitutional should be applied retroactively. In reversing the trial court on this point, the court said, "The rule is well established that when resort to judicial proceedings is required to enforce collection of a tax or assessment the payment of such tax or assessment is not deemed made under compulsion and an action for its recovery will not lie." (127 Cal.App. at p. 753.) Section 6650 (Welf. & Inst. Code) provides liability for the care and support of a mentally ill person on certain of his relatives. This is a liability imposed by law, just as a tax is and a stockholder's liability for assessment formerly was. It seems reasonable and logical to apply that rule to the situation in the case at bench.
 In Wingerter v. City & County of San Francisco (1901) 134 Cal. 547 [66 P. 730, 86 Am.St.Rep. 294], an 1895 statute required the county clerk upon the filing of the inventory and appraisement to charge the estate and collect from it the sum of one dollar for each $1,000 of the appraised valuation of the estate in excess of $3,000. In 1897 the Supreme Court held the provision to be unconstitutional. In an action by the executor of an estate to recover $325 paid under the unconstitutional statute, the court on denying recovery quoted from Cooley v. County of Calaveras, supra, the rule to the effect that no recovery can be had of moneys paid under an unconstitutional statute.
 5. Section 905.2 of Government Code Does Not Apply.
 Plaintiff seems to contend that section 905.2 in itself provides plaintiff with a cause of action. *588
 That section provides, in pertinent part, for presentation of "all claims for money or damages against the State ... (d) For which settlement is not otherwise provided for by statute or constitutional provision." This contention is answered by section 905.8: "Nothing in this part imposes liability upon a public entity unless such liability otherwise exists." As we show herein, no liability exists upon the part of defendant to return the moneys paid by the estate in compromise of the state's claim then considered valid.
 Plaintiff contends that Kirchner should be applied retroactively to allow a return of the estate's money on an unjust enrichment theory. However, it must be remembered that this is not an action brought by the state to collect a claim for care which was legal at the time presented and as to which the court is being asked to enforce the claim after the determination that the claim is no longer legal, but is an action for return of moneys paid in compromise at a time when the claim was still legal.
 In view of the above cited decisions, the unjust enrichment theory does not apply to the situation in the instant case.
 6. Applicability of Kirchner.
 Throughout this opinion we have assumed that the ruling in Kirchner would apply to the facts of this case. Kirchner held, in effect, that a statute which required certain relatives to pay for the care of a mentally ill person who has an estate of his own is unconstitutional as violative of the equal protection clause, because of lack of reasonable basis for the classification of the persons liable. It may very well be that the rule in Kirchner only applies where the mentally ill person has estate of his own. For the reasons that the record in the instant case fails to disclose whether or not Albina has estate and that, even assuming that Kirchner applies to the facts here, plaintiff, because of the probate decree, the dismissal with prejudice, and the rule of Campbell and the other cases hereinbefore cited, has no cause of action, we deem it unnecessary to determine the applicability of Kirchner. See County of Alameda v. Kaiser (1965) 238 Cal.App.2d 815 [48 Cal.Rptr. 343], where the court held Kirchner inapplicable to a situation where the county sued the mother of a minor for county medical care, the court saying, referring to the parent's responsibility for the support of a minor child, "One reason for imposing this obligation is to prevent the child from becoming a public *589 charge (Federal Mutual Liability Ins. Co. v. Industrial Acc. Com., supra, 195 Cal. 283, 289-290 [233 P. 335].) This long-recognized liability, often enforced, has not been held to be based upon unreasonable classification. Thus Kirchner's proscription of denial of equal protection seems to have no application" (p. 818).
 Judgment affirmed.
 Draper, P. J., and Salsman, J., concurred.
NOTES
[fn. *]  *. Retired Presiding Justice of the Court of Appeal sitting under assignment by the Chairman of the Judicial Council.
[fn. 1]  1. It is not contended that conditions (a) and (b) were not met in the case at bench.
