
745 S.W.2d 842 (1988)
CITY OF HANNIBAL, Plaintiff-Appellant,
v.
COUNTY OF MARION, et al., Defendants-Respondents.
No. 53321.
Missouri Court of Appeals, Eastern District, Division Four.
February 23, 1988.
Marion F. Wasinger, Hannibal, for plaintiff-appellant.
Branson L. Wood, Hannibal, for defendants-respondents.
*843 CRANDALL, Judge.
Plaintiff, City of Hannibal (Hannibal), brought this action against defendant, County of Marion (County), regarding road taxes paid to the County. Hannibal appeals from the judgment of the trial court which declared a section of Hannibal's city charter unconstitutional. We reverse and remand.[1]
The pertinent facts, as gleaned from the petition, are that Hannibal adopted a Home Rule Charter pursuant to Article VI, Section 9 of the Missouri Constitution of 1945. Section 20.25 of that charter reaffirmed that portion of Hannibal's Legislative Charter of 1873 which exempted Hannibal's citizens from the "County Poor and Road Tax." Section 20.25 adopted the following language from the 1873 charter:
The City of Hannibal shall at its own proper expense, make, maintain and keep in repair all streets, roads and bridges within the limits of the City, and provide for the maintenance and support of its own poor, and in consideration thereof the citizens of Hannibal shall be exempt from all county tax for the support of the poor, or for the construction or maintenance of any roads or bridges in any part of Marion County, outside of the limits of said city, or for paying for any right-of-way for the same, and if the County Court of Marion County shall make any expenditure for the support of the poor, or for the construction, maintenance or repairs of any road or bridge, or the right-of-way for the same in any part of said county, outside of the limits of said city, and pay for the same out of the county funds, said county shall pay to the Treasurer of the City of Hannibal for the use of said city, a sum of money which shall bear the same proportion to the amount so expended as the assessed value of all property subject to county taxation in the City of Hannibal shall bear to the assessed value of similar property in the remainder of the county.
In 1956 and again in 1961, Hannibal and County entered into contracts in which Hannibal agreed not to enforce this section of its charter.
In November 1986, Hannibal filed its petition against the County, the County Commissioners, and the Tax Collector. Count I sought declaratory judgment concerning the validity of Section 20.25 of its charter. Count II sought to enjoin the County, the Commissioners, and the Tax Collector from assessing and levying taxes from Hannibal citizens attributable to the construction, maintenance, and repair of roads and bridges in the County. Count III sought to enjoin a certain commissioner for County from voting on any matter relating to this dispute. Count IV sought an accounting and damages for taxes collected by County from Hannibal citizens for the past 30 years and for a proportionate payment of expenditures for road and bridge repairs outside the city limits.
County filed several motions. There was a motion to make Hannibal's petition more definite and certain. There also was a motion to strike which challenged Hannibal's standing to assert the Section 20.25 tax exemption for its citizens. There was a separate motion to dismiss Count III. There was another motion to dismiss which objected to the constitutionality of Section 20.25 with regard to Counts I and IV. That motion also challenged Count II on the basis that Hannibal failed to exhaust its administrative remedies for challenging a tax assessment.
After the motions were argued, the trial court entered a "Memorandum Opinion and Order" in which it denied County's motions as to all issues except the constitutionality of Section 20.25. The trial court entered a judgment in which it stated that Hannibal's "petition states a cause of action for declaratory judgment, but Section 20.25 of the City of Hannibal Charter is constitutionally repugnant for all of the reasons stated in the Memorandum Opinion...."
Before considering the substantive issues on appeal, we first address the procedural posture of the present case. The only motions which were before the trial *844 court for ruling and which addressed issues pertinent to this appeal were County's motions to dismiss. The court's final judgment, in effect, overruled County's motions to dismiss when it found that Hannibal's petition stated a cause of action for declaratory relief. The trial court also entered judgment in favor of County when it found that Section 20.25 of Hannibal's charter was unconstitutional.
Motions to dismiss can be converted to motions for summary judgment when matters outside the pleadings are presented to and considered by the trial court. See Rule 55.27(a). In this case neither the trial court nor the parties treated the motions to dismiss as motions for summary judgment. We, therefore, address the issues in light of a ruling on a motion to dismiss.
We now address the primary issues raised on appeal. This case focuses on whether Hannibal can enforce two rights conferred by Section 20.25 of Hannibal's charter. Pursuant to that charter provision, Hannibal seeks (1) an exemption from the County poor tax and road tax on behalf of its citizens and (2) a proportionate payment from County to Hannibal for any expenditures that County made on roads and bridges outside the city limits.
Concerning the tax exemption which Hannibal seeks on behalf of its citizens, the pivotal issue is one of standing. In its motion to dismiss Counts I and IV, County alleges that Hannibal "is not the real party in interest and lacks standing to assert the tax exemption...." The trial court implicitly ruled that Hannibal had standing to pursue the exemption claim against County when it held that Hannibal's petition stated a claim for declaratory relief.
In a declaratory judgment action, the standard to be applied in determining whether a party has standing to bring a suit is whether the plaintiff has a legally protectable interest at stake. Cheatham v. Walsh, 669 S.W.2d 587, 589 (Mo.App.1984). The matter of standing does not relate to the legal capacity to sue, but to the interest of an adversary in the subject of the suit as an antecedent to the right to relief. Crigler v. Frame, 632 S.W.2d 94, 96 (Mo.App. 1982). It is therefore "jurisdictional in limine and so within the notice of a court, even on appeal, for dismissal." Id.
Rule 52.01 requires that an action be prosecuted in the name of the "real party in interest." Hannibal cites to Rule 87 pertaining to declaratory judgments as the source of its authority to bring this action. Rule 87.05 includes a municipal corporation within the definition of person. Rule 87.02(a) provides that "[a]ny person... whose rights, status or other legal relations are affected by a statute, municipal ordinance, contract or franchise...." can bring a declaratory judgment action. Even if we assume that the charter provision has the status of a statute or ordinance within the meaning of the Rule 87, the Rule only confers upon Hannibal the general right to bring a declaratory action. It does not resolve the issue of standing in a particular action.
Hannibal cites to Ferguson Police Officers Ass'n. v. City of Ferguson, 670 S.W. 2d 921 (Mo.App.1984) for the proposition that a declaratory judgment action is "peculiarly suited to interpreting and declaring the validity of statutes, ordinances and provisions of a charter...." Id. at 925. The holding in that case, while correct as a general proposition of law, is not germane to the issue of standing in the case sub judice.
State ex rel. City of St. Louis v. Litz, 653 S.W.2d 703 (Mo.App.1983), cited by Hannibal, involved an ordinance relating to the regulation of demolition permits in the City of Berkeley (Berkeley). The relator was the City of St. Louis (St. Louis). St. Louis owned property within Berkeley. The ordinance directly affected St. Louis in the performance of its responsibilities for undertaking airport expansion. Clearly, St. Louis had standing, although it was not a taxpayer within Berkeley. St. Louis had an actual or justiciable interest susceptible of protection through litigation. Id. at 706-707. Here, Hannibal does not meet that test.
*845 The tax exemption afforded by Section 20.25, by its specific language, applies only to the citizens of Hannibal. In its brief, Hannibal concedes that it is not a taxpayer subject to the statutory review procedures of Chapter 139 and that it is not directly challenging any particular tax assessment or ruling. Hannibal claims that, as a municipality with a constitutional charter and as a party to purported contracts with County, it is merely seeking a declaration of its rights and attendant supplemental relief.
The thrust of Hannibal's exemption claim, however, is to secure a tax exemption for its citizens. In this posture, Hannibal is seeking to enforce the rights of a third party. Hannibal has no actual and justiciable interest of its own in the tax exemption contained in Section 20.25.
Hannibal asserts that, if "further standing is required," it has representational standing to bring the suit on behalf of its taxpayers. Although the prayer in the petition asked for relief on behalf of its citizens, Hannibal brought the action only in the name of the City of Hannibal not in the name of the City of Hannibal as the representative of its citizens. Hannibal simply did not plead any facts giving rise to a legal theory which would give it the right to seek relief on behalf on the citizens.
The cases which Hannibal cites to support its argument that it had representative standing to bring this action are inapposite. Ferguson Police Officers, 670 S.W. 2d at 921 and Citizens for Rural Preservation, Inc. v. Robinett, 648 S.W.2d 117 (Mo. App.1982) deal with allowing associations to bring declaratory judgment actions in a representative capacity for their members. Those cases have no application to a city bringing a lawsuit on behalf of its taxpayers. Even if the three criteria used to determine standing for an association, as articulated in Ferguson Police Officers, were applicable in this case, there is nothing in the pleadings which indicate that plaintiff could satisfy that test.
Hannibal lacks standing to seek enforcement of the tax exemption for its citizens. The trial court erred in failing to sustain, for lack of standing, County's motions to dismiss paragraph five of the prayer of Count I; Count II in its entirety; paragraph four of Count III and those portions of paragraph seven and of the prayer of Count III which seek to enjoin a County Commissioner from voting on matters relating to the tax exemption for Hannibal's citizens; and paragraph four of Count IV and that part of the prayer of Count IV relating to payback from County to Hannibal's citizens.
The second major issue on appeal is whether Hannibal is entitled to a proportionate payment from County for expenditures County made on roads and bridges outside the city limits. The second part of Section 20.25 of Hannibal's charter provides for such a payback. The trial court correctly found that Hannibal's petition stated a cause of action for declaratory judgment as to that issue. The trial court then held that Section 20.25 was unconstitutional and void.
It is not the function of this court on appeal from a ruling on a motion to dismiss to make an analysis of the law under which the rights are claimed or to determine whether plaintiff is entitled to the declaratory relief he seeks in accordance with the theory he states. Higday v. Nickolaus, 469 S.W.2d 859, 864 (Mo.App. 1971). If under the facts pleaded a plaintiff is entitled to declaration of rights at all, the petition is sufficient for that purpose even though it advances a mistaken contention of law. Id.; Transport Mfg. & Equip. Co. v. Toberman, 301 S.W.2d 801, 805 (Mo. banc 1957). A plaintiff's standing to claim declaratory reliefand to assert a legally protectible interestis not impaired by the probability that ultimately he will not prevail. Higday, 469 S.W.2d at 864.
Here, the trial court only had County's motions to dismiss before it. The trial court ruled that Hannibal's petition was sufficient to state a claim in declaratory relief. The trial court then granted County the declaratory relief which County sought; namely, a declaration that Section 20.25 of Hannibal's charter was unconstitutional. The trial court was not authorized to use a *846 ruling on County's motions to dismiss as a vehicle to enter judgment on the merits. Once the trial court found that Hannibal was entitled to declaratory relief, the motions to dismiss were overruled. At this point, Hannibal was entitled to win or lose after a submission of the issue on the merits.
The trial court therefore improperly entered judgment on County's motions to dismiss paragraphs one, two, three, four and six of the prayer of Count I which relate to the payment from County to Hannibal for expenditures on roads and bridges outside the city limits; paragraphs one, two, three, five and six of Count III and that portion of paragraph seven and the prayer of Count III which seek to enjoin a County Commissioner from voting on matters relating to the payback from County to Hannibal; and paragraphs one, two, three, and five of Count IV and that part of the prayer of Count IV which relates to the payback from County to Hannibal.
That portion of the judgment of the trial court holding that Hannibal had standing to enforce that part of Section 20.25 of its charter which pertains to the taxpayers' exemption from County taxes is reversed and remanded with directions to sustain County's motion to dismiss. That portion of the judgment which holds as unconstitutional that part of Section 20.25 of Hannibal's charter which provides for a proportionate payback from County to Hannibal for expenditures made by County on roads and bridges outside the city limits is reversed and remanded with directions to permit the parties to properly submit the issue for adjudication in a manner consistent with this opinion, either by a motion for summary judgment or by an evidentiary hearing. We express no view as to which method would be appropriate in this case. In view of our ruling, we do not address other issues raised by the parties.
SIMON, P.J., and GRIMM, J., concur.
NOTES
[1]  This appeal was originally filed in the Missouri Supreme Court. The Supreme Court then transferred the appeal to this court "in which jurisdiction is vested."
