
618 A.2d 1314 (1992)
David MERRILEES, et al.
v.
TREASURER, STATE OF VERMONT, et al.
No. 91-114.
Supreme Court of Vermont.
October 2, 1992.
*1315 Before ALLEN, C.J., and GIBSON, DOOLEY, MORSE and JOHNSON, JJ.
At issue is whether passage of Senate Bill 39 (1985), codified at 13 V.S.A. §§ 7281-7283, levying a $5.00 surcharge on certain penalties and fines paid to the state, violated the origination clause of the Vermont Constitution, Chapter II, § 6 (revenue bills must originate in the House of Representatives). The issue was raised in a class action brought by plaintiff Merrilees on behalf of all those against whom the surcharge had been levied. The trial court found that the contested measure was not a revenue bill and entered summary judgment in defendant's favor. This appeal followed. We affirm.
Following our policy of deciding cases on nonconstitutional grounds, we asked the parties to brief an issue which they had not raised, that is, whether this appeal is controlled by Chittenden Trust Co. v. MacPherson, 139 Vt. 281, 284-85, 427 A.2d 356, 358-59 (1981) (in actions to recover monies required to be paid pursuant to judicial proceeding, appeal must be taken directly; absent fraud, res judicata bars collateral attack on issues that were or could have been raised in proceeding).
In response to this request, plaintiffs challenge this Court's authority to raise sua sponte the issue of res judicata. Res judicata is an affirmative defense that is waived if not raised by the parties. V.R.C.P. 8(c). Ordinarily, if such a defense is not raised in the pleadings, it is not available at trial or on appeal. Brouha v. Postman, 145 Vt. 449, 452, 491 A.2d 1038, 1040 (1985). The rule, however, is subject to exceptions. See City of Burlington v. Mountain Cable Co., 151 Vt. 161, 163, 559 A.2d 153, 154 (1988) (Court will recognize unraised affirmative defense of illegality "if of a serious nature"). Rule 8(c) is a notice provision, intended to prevent unfair surprise at trial. But notice considerations are not implicated here. No factual development is required to decide res judicata, and the parties have been given an opportunity to fully brief the issue.
In addition, ample and persuasive precedent allows a court to raise res judicata on its own where the parties have failed to raise it and consequently waived the right to do so. Dakota Title & Escrow Co. v. World-Wide Steel Systems, Inc., 238 Neb. 519, 525-26, 471 N.W.2d 430, 434-45 (1991) (adopting the principle and citing authority). Allowing an appellate court to raise res judicata is consistent with policies of avoiding unnecessary judicial waste, id. at 526, 471 N.W.2d at 435, and fostering reliance on judicial decisions by precluding relitigation, Wilson v. United States, 166 F.2d 527, 529 (8th Cir.1948). Moreover, it is consistent with the rule that judgments are entitled to be affirmed if any legal ground exists to do so, even one not raised by the parties, Robertson v. Interstate Securities *1316 Co., 435 F.2d 784, 787 n. 4 (8th Cir.1971), a rule long followed by this Court in other contexts. See, e.g., Richards v. Union High School District No. 32, 137 Vt. 132, 134, 400 A.2d 987, 989 (1979).
Res judicata bars parties from relitigating, not only those claims and issues that were previously litigated, but also those that could have been litigated in a prior action. Converse v. Town of Charleston, ___ Vt. ___, ___, 605 A.2d 535, 537 (1992). Although there is no record on this point, the parties do not dispute that members of the plaintiff class were subject to criminal or administrative proceedings in which each paid the surcharge without objecting on constitutional grounds. The origination clause issue, without doubt, could have been raised in those proceedings. Instead, these litigants were joined together in a class action, a collateral proceeding initiated after their own individual proceedings were completed, which is precisely the type of attack that MacPherson condemns.
To the contrary, plaintiffs assert that a criminal conviction should not support issue preclusion in a later civil action. Assuming this principle were correct, it would not apply here. This case is res judicata by virtue of claim, not issue, preclusion, which bars parties from litigating claims or causes of action that were or should have been raised in previous litigation where the parties, subject matter, and causes of action are identical or substantially identical. American Trucking Ass'ns v. Conway, 152 Vt. 363, 370, 566 A.2d 1323, 1328 (1989). The doctrine specifically bars defendants from using defenses available in one action as the basis for a claim in a later action. 18 C. Wright, A. Miller & E. Cooper, Federal Practice and Procedure, § 4414, at 111 (1981).
Even though res judicata governs this case, plaintiffs nonetheless argue that policies favoring class actions should be recognized over those favoring res judicata. As a practical matter, plaintiffs assert, no individual litigant would have attempted to recover a minor sum ($5.00) in light of the time and expense involved in litigation and appeal, and consequently, only a class action suit makes this litigation possible. Res judicata is a "judicially created rule of law," American Trucking, 152 Vt. at 371, 566 A.2d at 1328, and a very small number of cases avoid preclusion on broad grounds of "public interest" or "unwarranted injustice." 18 Wright, Miller & Cooper, supra, at 131-35. Plaintiffs ask us, in effect, to create such an exception and, in the process, to overrule the direct precedent of MacPherson. They make no compelling argument for us to do either.
MacPherson cannot be distinguished. In that case, executors who had paid probate distribution fees when closing estates later sought to bring a class action to recover the fees on the ground they were unconstitutional taxes. This attempt was barred by res judicata because each class member could have raised the constitutional issue in the prior probate proceeding. As here, the individual executors may have had little incentive to challenge the allegedly unconstitutional tax. Small amounts were at issue, and the main focus of the proceeding was to close the estate. Yet, we found these reasons insufficient to disturb the finality of prior judgments. 139 Vt. at 285, 427 A.2d at 359.
Plaintiffs' argument for class status is far weaker than that in MacPherson. Unlike the probate context, many of the class members subject to the surcharge would have been represented by public defenders; they would not personally be forced to bear the cost of raising the constitutional issue. Moreover, many of the cases would have been contested and many would have been appealed. Any one of them could have been a vehicle for receiving a decision from this Court.
Here, as in MacPherson, the issue is finality, not the obvious utility of aggregating small claims in a class action. By failing to raise the asserted illegality of the surcharge to the court assessing the charge, plaintiffs, by their own inaction, have created the necessity for aggregation. If they prevail, the burden shifts to the state to locate and reimburse persons who *1317 failed to complain about the charge when it was directly before the court. Under these circumstances, plaintiffs' aggregation argument does not outweigh the need for finality.
Affirmed.
