
976 S.W.2d 518 (1998)
Alan RELL, Appellant/Plaintiff,
v.
BURLINGTON NORTHERN RAILROAD COMPANY, et al., Respondents/Defendants.
No. 72998.
Missouri Court of Appeals, Eastern District, Division Five.
June 30, 1998.
Motion for Rehearing and/or Transfer Denied August 26, 1998.
Application for Transfer Denied October 20, 1998.
*519 Cordell Siegel, Don V. Kelly, St. Louis, for appellant/plaintiff.
William A. Brasher, St. Louis, respondents/defendants.
Motion for Rehearing and/or Transfer to Supreme Court Denied August 26, 1998.
CRAHAN, Chief Judge.
Alan Rell ("Driver") appeals from a judgment granting motions to dismiss in favor of Burlington Northern Railroad Company ("Railroad") and St. Charles County ("County") in his suit for negligence arising out of a collision between his truck and a train. We affirm.
Driver's petition alleges that on July 12, 1995, he collided with one of Railroad's trains at the intersection of Railroad's tracks and Peruque Creek Road in St. Charles County. In Count I, Driver further alleges that Railroad *520 failed to fulfill its duty to adequately warn travelers on Peruque Creek Road of its crossing. Driver asserts that Railroad negligently allowed vegetation to overgrow and obscure the one warning sign that was posted on Peruque Creek Road as well as the intersection and trains themselves. In Count II, Driver claims that County also failed to adequately warn travelers on Peruque Creek Road of the dangerous crossing and negligently allowed vegetation on its property to obscure the warning sign and the crossing. Driver further alleges he has suffered extensive physical and mental injuries because of Railroad and County's negligence.
County filed a Motion to Dismiss Count II for Failure to State a Claim because, inter alia, the dangerous condition about which Driver claimed County negligently failed to warn him did not exist on County's property.
Railroad later filed a motion to dismiss Count I for lack of jurisdiction because Driver failed to assert his cause of action as a compulsory counterclaim to a claim Railroad had previously asserted against Driver and his employer regarding the same collision. Railroad later amended its motion and attached pleadings, verified by affidavit, establishing that on February 13, 1996, Driver, his employer and Railroad settled a lawsuit Railroad had filed in which Railroad alleged Driver negligently caused a collision between its train and Driver's truck on Peruque Creek Road.
The trial court entered judgment sustaining both motions. This appeal followed.
In his first point, Driver argues that Railroad was not entitled to a dismissal because: (1) Railroad failed to preserve its affirmative defense that Driver's claim was a compulsory counterclaim to a previous lawsuit filed by Railroad, (2) the trial court was limited to the pleadings in deciding Railroad's motion, and no evidence of Driver's failure to raise a compulsory counterclaim was properly before it, and (3) even if the court could have properly decided the issue of Driver's failure to raise a compulsory counterclaim, the settlement of the previous lawsuit precluded Railroad from successfully raising that defense. We shall take up these arguments in the order Driver raised them.
First, a court lacks jurisdiction if a later action is taken on a matter that should have been brought as a compulsory counterclaim. Evergreen Nat. Corp. v. Killian Construction Co., 876 S.W.2d 633, 635 (Mo.App. 1994); State ex rel. J.E. Dunn, Jr. & Assoc. v. Schoenlaub, 668 S.W.2d 72, 74 (Mo. banc 1984). Therefore, Railroad did not need to preserve its claim of Driver's failure to raise a compulsory counterclaim. The issue of subject matter jurisdiction cannot be waived and can be raised at any stage of the proceedings. Williams v. Williams, 932 S.W.2d 904, 905 (Mo.App.1996).
Second, a court is not restricted to the pleadings in considering a motion to dismiss for lack of jurisdiction. See Chromalloy American Corp. v. Elyria Foundry Co., 955 S.W.2d 1, 2-3 (Mo. banc 1997); Smith v. Hussman Corp., 866 S.W.2d 505, 506 (Mo. App.1993).[1] Driver cites several cases that hold the trial court is limited to the pleadings when considering a motion to dismiss due to the existence of certain affirmative defenses. Lack of subject matter jurisdiction, however, is not an affirmative defense that must be raised at the first opportunity or be waived. Rule 55.27(g)(3). Moreover, a plaintiff's failure to raise a compulsory counterclaim is usually impossible to discern from the face of a petition.[2] The trial court had to consider *521 evidence of the previous lawsuit between Driver and Railroad to determine whether it had jurisdiction to proceed. Indeed, Driver does not dispute the accuracy of Railroad's evidence. He only mistakenly asserts that it was procedurally improper for the court to consider it when it did.
Finally, Driver argues that he should not be barred for failing to raise a compulsory counterclaim because the previous lawsuit between him and Railroad was settled. Driver cites Black v. Sanders, 414 S.W.2d 241 (Mo. banc 1967) in support of that proposition. Black held that a settlement, which expressly reserved a specific counterclaim from the otherwise resolved lawsuit, did not bar the later adjudication of that specifically reserved cause of action. 414 S.W.2d at 245. However, Black noted that the specific reservation language in the settlement was crucial to its decision, distinguishing the settlement at issue from a more general settlement in which the parties state that all the matters and things in controversy have been settled. Id. at 244.
In the present case, the stipulation of settlement signed by Driver and Railroad failed to reserve any claims and, in fact, stated that "all matters in controversy [had been] agreed upon and settled." The trial court properly interpreted this particular settlement to foreclose any further adjudication of claims arising out of that collision. See Sexton v. First Nat. Mercantile Bank & Trust Co. of Joplin, 713 S.W.2d 30, 31 (Mo. App.1986); Keller v. Keklikian, 362 Mo. 919, 244 S.W.2d 1001, 1005 (1952). Point denied.
In his second point, Driver claims that County was not entitled to a dismissal because the pleadings adequately stated a cause of action for negligence in failing to warn of a dangerous condition on its land and County's sovereign immunity does not defeat his claim.
When reviewing the grant of a motion to dismiss, an appellate court must determine if the facts pleaded and the inferences reasonably drawn therefrom state any ground for relief. Tillison v. Boyer, 939 S.W.2d 471, 472 (Mo.App.1996); Lehnig v. Bornhop, 859 S.W.2d 271, 272 (Mo.App.1993). All facts averred in the petition are treated as true and are construed liberally and favorably to the appellant. Tillison, 939 S.W.2d at 472. The appellate court will reverse the trial court's dismissal of a pleading for failure to state a claim upon which relief can be granted if after viewing the pleading in its broadest intendment the averments invoke principles of substantive law which may entitle plaintiff to relief. Id. An appellate court may not, in making such a determination, address the merits of the case or consider evidence outside of the pleadings. Brennan v. Curators of the University of Missouri, 942 S.W.2d 432, 434 (Mo.App.1997).
In order to establish a claim under the statutory exception to sovereign immunity for a dangerous condition on a public entity's property, Driver must show 1) a dangerous condition of the property; 2) that his injuries directly resulted from the dangerous condition; 3) that the dangerous condition created a reasonably foreseeable risk of harm of the kind he incurred; and 4) that a public employee negligently created the condition or the public entity had actual or constructive notice of the dangerous condition. Tillison v. Boyer, 939 S.W.2d 471, 473 (Mo.App.1996). See also section 537.600.1(2) RSMo 1994. Further, the provisions in the statute waiving sovereign immunity are to be narrowly construed. Terry v. McIntosh, 941 S.W.2d 595, 598 (Mo.App.1997).
Driver alleged that "the lack of any other signs or warnings rendered Peruque Creek Road at or near its intersection with the tracks of [Railroad] an unsafe condition for public travel."
To show a dangerous condition "of the property" attributable to County, Driver had to allege that County had "exclusive control and possession" of Peruque Creek Road "at or near" its intersection with the railroad tracks. See Tillison, 939 S.W.2d at 473. Whatever County's interest in the railroad crossing, it cannot be said that it was one under which County enjoyed exclusive control and possession. Indeed, Driver acknowledged *522 in his Petition that the railroad tracks and easement property adjacent thereto belonged to Railroad, not County. Therefore, County is immune from liability for any dangerous condition alleged to exist "at" the intersection of a county road and the privately controlled railroad tracks or for the failure to warn thereof.
With respect to Peruque Creek Road before it intersects the railroad tracks (i.e. "near" the tracks, giving Driver's petition its broadest intendment), Driver also alleged County failed to maintain the land near the crossing so that the warning sign was "entirely obscured and not capable of being seen due to the overgrowth of vegetation and foliage...near the crossing."
A landowner can be liable in negligence for a condition on her land that creates an unreasonable risk of harm to those outside of her land. Jackson v. City of Blue Springs, 904 S.W.2d 322, 328-34 (Mo.App. 1995) (private landowner not entitled to summary judgment on claim that overgrown vegetation on his land blocked drivers' views of a public intersection while traveling on a public way). However, Driver himself alleged that the warning sign which was obscured by foliage was "situated on the railroad's easement," not on property controlled by County. Moreover, County points out in its brief that by statute, "it shall be the duty of [Railroad] to maintain the right-of-way at public grade crossings so that it will be reasonably clear of vegetation, undergrowth and other debris for a distance of two hundred fifty feet each way from the near edge of such crossings where such things would materially obscure approaching trains from the view of travelers on the highway." Section 389.665.2 RSMo 1994.
The sign Driver alleged to have been obscured by excessive vegetation was not, according to his own petition, on property over which County could exercise exclusive possession and control. Moreover, Railroad, not County, was under a legal duty to keep the crossing and the land surrounding it clear of vegetation. Driver's petition, therefore, alleged neither the presence of an unreasonably dangerous condition on County controlled land nor any legal duty attributable to County with respect to the land on which a dangerous condition was alleged to exist. See Tillison, 939 S.W.2d at 473. Driver's petition failed to state a claim arising under any exception to County's sovereign immunity. Point denied.
The judgment is affirmed.
RICHARD B. TEITELMAN, J., and ROBERT E. CRIST, Senior Judge, concur.
NOTES
[1]  Driver urges that Rule 55.27 requires that, if the trial court considers matters outside the pleadings in connection with a motion to dismiss, it must give notice that it is treating the motion as a motion for summary judgment as provided in Rule 74.04. By its express terms, however, this requirement of Rule 55.27 applies only when the trial court considers matters outside the record in connection with a motion to dismiss for failure to state a claim upon which relief can be granted. Rule 55.27(a). The rule contains no such requirement for motions to dismiss for lack of subject matter jurisdiction, which are to be granted "whenever it appears" by suggestion of the parties or otherwise that the court lacks subject matter jurisdiction. Rule 55.27(g)(3).
[2]  Although the trial court noted it would "not consider matters outside the pleadings" to resolve Railroad's motion to dismiss, it obviously had to consider the pleadings appended to Railroad's motion to find it had no jurisdiction to adjudicate Driver's claim against Railroad. As discussed supra, it was entirely appropriate for the trial court to do so.
