
806 S.W.2d 311 (1991)
Bob BULLOCK, Comptroller of Public Accounts and His Successor in Interest, The Texas Alcohol and Beverage Commission, Appellants,
v.
REGULAR VETERANS ASSOCIATION OF the U.S., POST NO. 76, Appellee.
No. 3-90-142-CV.
Court of Appeals of Texas, Austin.
March 13, 1991.
*312 Jim Mattox, Atty. Gen., Brooks Wm. (Bill) Conover, III, Asst. Atty. Gen., Austin, for appellants.
Don E. Peavy, Sr., Fort Worth, for appellee.
Before CARROLL, C.J., and ABOUSSIE and JONES, JJ.
JONES, Justice.
Bob Bullock, the Comptroller of Public Accounts, and his successor in interest, the Texas Alcoholic Beverage Commission,[1] appeal a judgment declaring section 2(4)(A)(iv) of the Bingo Enabling Act, Tex. Rev.Civ.Stat.Ann. art. 179d (Supp.1991), to be unconstitutional and awarding attorney's fees to appellee, Regular Veterans Association of the United States, Post No. 76 (Regular Veterans). The Comptroller challenges the judgment on the following bases: (1) that section 2(4)(A)(iv) of the Act is constitutional; (2) that there was no proper basis for the award of attorney's fees; (3) that the State was protected by sovereign immunity from suit and liability; and (4) that the Comptroller should have been awarded attorney's fees. We will affirm the trial court's judgment.
Regular Veterans is a nationwide organization the members of which are veterans and their dependents. It has operated since 1880, raising funds for charitable work principally through the conducting of bingo games. When a Texas post first sought a license to conduct bingo games in Texas, the present dispute ensued. Although the Comptroller issued the post a temporary permit, he denied its application for a permanent license on the ground that it was not eligible for licensure under the Act. Regular Veterans then brought suit seeking a declaration that the Act unconstitutionally limited the groups eligible for licensure; the suit also sought an injunction barring the Comptroller from enforcing the challenged provisions. After a bench trial, the district court declared unconstitutional the provision of the Act, section 2(4)(A)(iv), that excludes from the class of "fraternal organizations" those groups comprised predominantly of veterans or their dependents. In addition, the court enjoined the Comptroller from enforcing the provision and awarded Regular Veterans $3,500.00 in attorney's fees. The Comptroller appeals from this judgment.

THE STATUTORY SCHEME
The Texas Constitution permits the legislature to authorize and regulate bingo games within the State to be conducted by a "church, synagogue, religious society, volunteer fire department, nonprofit veterans organization, fraternal organization, or nonprofit organization supporting medical research or treatment programs." Tex. Const. Ann. art. Ill, § 47(b) (1984) (emphasis added). In passing the Act to implement this constitutional authorization, the legislature set up a scheme by which qualified organizations could obtain licenses to conduct bingo games. The Act defines a "veterans organization" as: *313 a nonprofit organization whose members are veterans or dependents of veterans of the armed services of the United States and that is chartered by the United States Congress and organized to advance the interests of veterans, or active duty personnel of the armed forces of the United States and their dependents.
Art. 179d, § 2(6) (emphasis added). A "fraternal organization" is defined as:
(A) a nonprofit organization that is organized to perform and engages primarily in performing charitable, benevolent, patriotic, employment-related, or educational functions and that:
(i) has been organized within Texas for at least three years;
(ii) during the three-year period has had a bona fide membership actively and continuously engaged as an organization in furthering its authorized purposes;
(iii) has not authorized any person on behalf of its membership, governing body, or officers to support or oppose a particular candidate for public office by making political speeches, passing out cards or other political literature, writing letters, signing or circulating petitions, making campaign contributions, or soliciting votes; and
(iv) is not an organization whose members are predominantly veterans or dependents of veterans of the armed services of the United States....
Art. 179d, § 2(4) (emphasis added).
Regular Veterans fits into neither category. Lacking a congressional charter, it does not fall within the definition of "veterans organization."[2] Being comprised entirely of veterans and their dependents, it is expressly excluded from the category of "fraternal organization."

CONSTITUTIONALITY OF SECTION 2(4)(A)(iv) OF THE ACT
The trial court held that, in the Act's definition of "fraternal organization," there is no rational basis for distinguishing between groups that are composed predominantly of veterans and their dependents and those that are not. The Comptroller contends that the trial court erred in so holding, and urges us to reverse the judgment declaring section 2(4)(A)(iv) unconstitutional and enjoining its enforcement.
We begin, as always when reviewing the constitutionality of a statute, with the presumption that the statute withstands constitutional challenge. Texas Public Bldg. Auth. v. Mattox, 686 S.W.2d 924, 927 (Tex. 1985); Sax v. Votteler, 648 S.W.2d 661, 664 (Tex.1983); Smith v. Davis, 426 S.W.2d 827, 831 (Tex.1968). Yet, although the challenger carries a heavy burden in order to do so, he may overcome the presumption with controverting proof. Spring Branch I.S.D. v. Stamos, 695 S.W.2d 556, 558 (Tex. 1985), appeal dism'd, 475 U.S. 1001, 106 S.Ct. 1170, 89 L.Ed.2d 290 (1986); Robinson v. Hill, 507 S.W.2d 521, 524 (Tex. 1974). In the present case, Regular Veterans bore the burden of showing that the contested provision deprived it of equal protection under the law as guaranteed by the United States and Texas Constitutions. See U.S. Const, amend. XIV; Tex. Const. Ann. art. I, § 3a (1984).
The test for impermissible discrimination is whether the classification causes similarly situated individuals to be treated differently without rational justification. Stout v. Grand Prairie I.S.D., 733 S.W.2d 290, 295 (Tex.App. 1987, writ ref'd n.r.e.); Prudential Health Care Plan, Inc. v. Commissioner of Ins., 626 S.W.2d 822, 830 (Tex.App.1981, writ ref'd n.r.e.). There must be a rational relationship between the classification system and the goals sought to be accomplished by the legislature. Whitworth v. Bynum, 699 S.W.2d 194, 197 (Tex.1985); Smith, 426 S.W.2d at 830. The classification will be considered reasonable if it is based on a real and substantial difference that relates to the legislative goal and operates the same way on all the class members. Railroad Comm `n v. Miller, 434 S.W.2d 670, 673 (Tex.1968).
*314 The Comptroller asserts, in part, that the rational basis for the distinction between groups composed primarily of veterans and other fraternal organizations is a desire to prohibit "fly-by-night" groups from placing the term "veterans" in their name in order to obtain the public's money deceptively or otherwise impermissibly. Such a goal is laudable. However, section 2(4)(A)(iv) does not exclude only those organizations using the term "veterans" in their name. Rather, it excludes all groups, irrespective of their name, "whose members are predominantly veterans or dependents of veterans of the armed services of the United States." Thus, under the Act, a bona fide nonprofit organization that meets all other criteria for licensure as a fraternal organization cannot obtain a bingo license if its membership happens to be composed primarily of veterans and their dependents. We can think of no rational basis for such a distinction.
Although the legislature's goal in enacting section 2(4)(A)(iv) may have been to target a relatively limited group, the inescapable effect of the language used is to exclude a much larger class. It is to this larger class that the rational-basis test of constitutionality must be applied.
We are mindful of our duty, when there are two possible constructions of a statute, one constitutional and one not, to adopt the construction that makes the statute constitutional. Ohio Oil Co. v. Giles, 149 Tex. 532, 235 S.W.2d 630, 637 (1950); City of Humble v. Metropolitan Transit Auth., 636 S.W.2d 484, 488 (Tex.App. 1982, writ ref'd n.r.e.), appeal dism'd sub nom., Archer v. Metropolitan Transit Auth., 464 U.S. 802, 104 S.Ct. 47, 78 L.Ed.2d 68 (1983). However, the language here leaves no room for construction. It unambiguously results in a distinction without a rational basis.
We conclude that the trial court correctly declared section 2(4)(A)(iv) of the Act unconstitutional. The Comptroller's fifth point of error is overruled. Having so determined, we next consider the attorney's fees and immunity issues.

ATTORNEY'S FEES
The Comptroller has a number of complaints with respect to the trial court's award of attorney's fees. First, he asserts that the court improperly based the award on chapter 104 of the Texas Civil Practice & Remedies Code, because Regular Veterans did not expressly allege that chapter as statutory authority for such an award. Tex.Civ.Prac. § 104.-001-.008 (1986 & Supp.1991). Second, the Comptroller objects that neither chapter 37 nor chapter 104 of the Code waives the State's sovereign immunity from suit or from liability. Id.; Tex.Civ.Prac. & Rem. Code Ann. §§ 37.001-.011 (1986 & Supp. 1991). Finally, the Comptroller claims that he, rather than Regular Veterans, was entitled to attorney's fees. We will address these contentions in order.
By his first point of error, the Comptroller contends that the trial court erroneously based its award of attorney's fees on chapter 104, Civil Practice & Remedies Code, because Regular Veterans failed to plead that or any other statutory provision as a basis for the award. The Comptroller correctly observes that a court may not render judgment on the basis of a theory not pleaded. See Tex.R.Civ.P.Ann. 301 (Supp.1991). However, Regular Veterans did not recover attorney's fees on the basis of an "unpleaded theory." In both its original and first amended petitions, Regular Veterans expressly sought recovery of attorney's fees. This general allegation put the Comptroller on notice that Regular Veterans was seeking attorney's fees; it was then incumbent on the Comptroller to point out, by special exception, any unacceptable lack of specificity in the pleading. His failure to do so waived the complaint. See Tex.R.Civ.P.Ann. 91 (1979).
When possible, an appellate court should uphold judgments allegedly unsupported by pleadings if the pleadings on file can be construed to support such judgment. Gallagher v. City of Brownsville, 429 S.W.2d 663, 667 (Tex.Civ.App.1968, writ ref'd n.r.e.). In recognition of this principle, and taking into account the Comptroller's failure to specially except or object at *315 appropriate times, we conclude that he waived his complaint concerning Regular Veterans' failure to allege specific statutory authority for the attorney's fees award.
However, even had the Comptroller not waived his complaint, the trial court did not expressly base its attorney's fee award on chapter 104 of the Code. The relevant paragraph of the judgment does not mention chapter 104 at all. The Comptroller's assumption that the award was based solely on chapter 104 stems from a letter written by the trial court to counsel in response to the Comptroller's motion for new trial. The letter does mention chapter 104 as an apparent basis for the award of attorney's fees. In construing a judgment that is clear and unambiguous in its terms, however, we may not incorporate the court's expressions of opinion or reasoning from outside the judgment. A judgment is to be construed as written. Speer v. Stover, 711 S.W.2d 730, 733 (Tex.App.1986, no writ); Higktower v. Bennight, 53 Tex.Civ.App. 120, 115 S.W. 875, 876 (1909, no writ). The judgment awards attorney's fees without reference to specific authority. We may not assume that chapter 104 was the only authority on which the court could have based the award.
On the other hand, in the absence of an agreement between the parties a Texas court may not award attorney's fees without some statutory basis. First City BankFarmers Branch v. Guex, 677 S.W.2d 25, 30 (Tex.1984); see also Tenneco Oil Co. v. Padre Drilling Co., 453 S.W.2d 814, 818 (Tex.1970). Therefore, we must determine whether there is such authority within the context of the causes pleaded. In order to make this determination, we must first consider the contention raised by the Comptroller in his second point of error: that the State is immune from liability for attorney's fees absent a waiver of that immunity, and that neither chapter 37 nor chapter 104 of the Civil Practice & Remedies Code waives the immunity.[3]
The Comptroller is correct in his contention, as far as it goes. We have previously held that neither chapter 37 nor chapter 104 waives the State's immunity from liability for attorney's fees. See Texas Employment Comm'n v. Camarena, 710 S.W.2d 665, 671 (Tex.App.1986), rev'd on other grounds, 754 S.W.2d 149 (Tex.1988); Texas Dept. of Human Services v. Methodist Retirement Services, Inc., 763 S.W.2d 613, 614 (Tex.App.1989, no writ). These holdings are inapplicable here, however, because a waiver of immunity resulted from the Comptroller's failure to plead sovereign immunity as an affirmative defense or "matter in avoidance," as required by Tex. R.Civ.P.Ann. 94 (1979).
When a governmental entity comes into Texas courts, it must abide by the same rules of pleading and procedure as do all other litigants. Davis v. City of San Antonio, 752 S.W.2d 518, 519 (Tex.1988). Specifically, the State has the burden of affirmatively pleading any matter constituting an avoidance or affirmative defense. Tex.R.Civ.P.Ann. 94 (1979). Failure to so plead waives the defense. Id. This is true even when the defense in question is sovereign immunity. Davis, 752 S.W.2d at 520; County of El Paso v. Boy's Concessions, Inc., 772 S.W.2d 291, 293 (Tex.App.1989, no writ). The Comptroller raised the defense of sovereign immunity for the first time in his motion for new trial. Therefore, we conclude that he has waived his right to assert the immunity defense.
The Comptroller does not discuss whether the Uniform Declaratory Judgments Act, Tex.Civ.Prac. & Rem.Code Ann. §§ 37.001.011 (1986 & Supp.1991), will support the award. Instead, he analogizes the present case to State v. Bodisch, 775 S.W.2d 73 (Tex.App.1989, writ denied). In Bodisch, this Court held that the State and its agencies were not liable for attorney's fees under chapter 38 of the Civil Practice & Remedies Code, because the challenged *316 provision authorized recovery of attorney's fees from "individuals" and "corporations," and the State is neither. Id. at 75; Tex. Civ.Prac.-§ 38.001.006 (1986). The present case is distinct from Bodisch. Section 37.009 of the Code authorizes courts hearing declaratory judgment actions to award costs and reasonable and necessary attorney's fees "as are equitable and just." Tex.Civ.Prac. & Rem.Code Ann. § 37.009 (1986). See also Duncan v. Pogue, 759 S.W.2d 435 (Tex.1988). It does not restrict the entities against whom such fees may be awarded, as does chapter 38. Such an award will not be disturbed absent a clear showing that the court abused its discretion. Oake v. Collin County, 692 S.W.2d 454, 455 (Tex.1985); Ritchie v. City of Fort Worth, 730 S.W.2d 448, 451 (Tex. App.1987, writ ref'd n.r.e.). Therefore, section 37.009 authorized the court below to award reasonable and necessary attorney's fees to Regular Veterans, unless barred by sovereign immunity. The Comptroller's first and second points of error are overruled.
The Comptroller next contends that he, not Regular Veterans, should have been awarded attorney's fees by the trial court. For the reasons discussed above, we find this contention without merit. The Comptroller's third point of error is overruled.
By point of error four, the Comptroller asserts that the court below was without jurisdiction to hear a suit against him for a declaratory judgment or for injunctive relief because chapters 37 and 65, Civil Practice & Remedies Code, did not waive the State's sovereign immunity from suit. Tex.Civ.Prac. & Rem.Code Ann. §§ 37.001.011, 65.001.045 (1986 & Supp.1991). For the same reasons that we have held the Comptroller to have waived the State's immunity from liability, we conclude that he has also waived immunity from suit. Point of error four is overruled.
We affirm the judgment of the trial court.
NOTES
[1]  The Texas Alcoholic Beverage Commission, as of January 1, 1990, became responsible for the issuance of licenses to conduct bingo games and for regulation of related activities. See 1989 Tex.Gen.Laws, ch. 238, at 1107. We will refer to the appellants collectively as "the Comptroller."
[2]  Assuming it wished to, Regular Veterans could not now obtain a congressional charter, because Congress has declared a moratorium on their issuance.
[3]  In cases involving sovereign immunity, it is always necessary to distinguish between: (1) immunity from suit without consent even though there is no dispute as to the State's liability, and (2) immunity from liability even though consent to the suit has already been granted. Missouri Pac. R.R. v. Brownsville Navigation Dist., 453 S.W.2d 812, 813 (Tex.1970).
