The defendants herein recovered a judgment in ejectment against plaintiff for the recovery of certain lands in Cedar county. Before possession was taken under said judgment the plaintiff, as the occupying claimant, commenced this suit, under section 4645, against these defendants, who were the plaintiffs in said ejectment suit, to recover compensation for improvements put upon the land in judgment. The petition contained the averments made necessai’y under section 4646.
Defendants answered admitting the judgment in ejectment and pleading as a set-off to such compensation the damages, rents and profits and costs recovered under said judgment, but did not in their answer ask for leave to relinquish the land to plaintiff, and recover the value thereof, aside from the improvement, as authorized by section 4648.
After a hearing of the issues, the court sitting as a jury found the value of the improvements to be $545, and the value of the land, aside from said improvements, to be $270. The judgment then recites: “Whereupon the defendants, in open court, elect to relinquish their title to said land to plaintiff and to recover the value thereof aside from said improvements from him.” Judgment was thereupon rendered that plaintiff in one year pay the defendants the said sum of $270, and that defendants then make to plaintiff a deed to said land with general warranty, “and in default of such payment the defendants herein shall take possession of said land discharged of all claim of said plaintiff herein.”
*361Plaintiff assigns for error that the judgment as rendered was not authorized under the pleadings.
The question presented by this record is whether the defendant, in this statutory proceeding to recover ■compensation for improvements put upon-land in good faith by the occupying claimant, must, by answer and before trial, elect to take the value of the land, aside from the improvements, or whether he can postpone such election until after the value of the land shall have been determined.
While this proceeding is purely statutory, the remedial provisions of the statute have ever been liberally construed in order to an equitable and fair adjustment of the rights of the parties. Stump v. Hornback, 94 Mo. 26; 109 Mo. 274, and cases cited. But while this equitable construction has been given in matters pertaining to the adjustment of the rights of the parties, the remedy is found alone under the statute, and in order to obtain the relief afforded thereby the parties must plead as therein indicated. As to the steps to be taken to obtain the relief, and the judgment to be rendered, the terms imposed by the statute must be accepted and its requirements followed. So it has been-said that “no remedy has been conferred by the statute on the party making the improvement except he comply with its terms,” and that a party out of possession can not maintain the action (Malone v. Stretcher, 69 Mo. 25) and that a judgment unauthorized by the statute can not be rendered. Russell v. Defrance, 39 Mo. 506.
The sections of the statute bearing upon this appeal make these provisions:
Section 4645 gives the right to the occupying claimant to maintain an action against the successful plaintiff in the ejectmentsuitforimprovements put uponthe land in good faith. Section 46'46 provides what the petition *362shall contain. Section 4647 authorizes an injunction to stay the plaintiff in the judgments in the ejectment suit from taking possession of the land until the value of the improvements is ascertained.
The other pertinent sections read as follows:
Section 4648. “The plaintiff may in his answer ask for leave to relinquish the land to the occupying claimant, and to recover the value thereof, aside from the improvements.”
Section 4649. “If the value of the improvements exceed the value of the land aside from the improvements, the court may order that the occupying claimant shall, by a time to be specified in the order, take the land, and pay the ascertained value thereof to the plaintiff, and in default of such payment the plaintiff shall take possession of the land, discharged from all claim of such occupying claimant.”
Section 4650. “In all cases where the occupying claimant shall be adjudged to take the land and pay the value thereof, the plaintiff shall, on payment of the money, make to the occupying claimant a conveyance thereof, with general warranty.”
It will be seen that under these provisions rights are given to each of the parties; to the occupying tenant to recover compensation for his improvements, and to the successful plaintiff, should the value of the improvements be found to exceed the value of the land, to relinquish his claim to the land and recover its value aside from the improvements. The statute points out what shall be done by each party in order to avail himself of its benefits. Pleadings are required of each, a petition by one claiming the compensation, an answer by the other offering to relinquish the land and take its value. The terms imposed by the statute are alike obligatory upon each. Where both make claim by proper pleadings, the value of the lands, as well as the *363value of the improvements, is put in issue, and after the respective values are found, the proper judgment can be entered.
The election to relinquish the land and take its value, the statute says, may be made by answer. Liberty is given to make it at no other time or in no other manner. Thus the law is written and the reason of it does not become a matter of inquiry.
But it is an elementary principle, under all rules of procedure, that the opposite party should have notice, before the trial, of the issues to be tried and of the possible results as it may affect his rights. Each party should have the right, under proper pleadings, to introduce evidence of value, and defendants should be required to abide the election made, should the improvements exceed the value of the land. . The occupying tenant, if the court so adjudges, must take and pay for the land at its assessed value or lose the benefit of his improvements and, in equity, he should have every opportunity given him to prove its value.
The bill of exceptions does not include the evidence upon which the court acted. In reference thereto it simply recites that “plaintiff introduced evidence tending to support' the allegations of his petition, and defendants offered evidence tending to contradict the same, and also to support the allegations in the answer.” The presumption, arising from the finding, which could otherwise be indulged, that the court, without objection, heard evidence of both parties as to the value of the land, is rebutted by the recitals in the bill of exceptions. Under this record we are not at liberty to say that the necessary pleading on the part of defendants, putting in issue the value of the land, and an offer to relinquish the land and recover its value, were waived.
Upon the record before us we are of the opinion *364that the court erred in its judgment requiring plaintiff to pay defendants the value of the land.
Judgment reversed and cause remanded that the pleadings may he amended, if the parties so desire, and a retrial had.
All concur.