Affirming.
This is a sequel to Riggsby v. Montgomery, 208 Ky. 524,271 S.W. 564, which reversed a judgment of the Magoffin circuit court and held that Betty Montgomery and her two children had no title to certain land and that it was in another group. After the judgment had been rendered in the circuit court in favor of Mrs. Montgomery and her children, she, for herself and as guardian, executed a lease of a parcel containing about 2 1/2 acres to John G. Arnett for use as a lumber and tie yard. The lease was dated May 10, 1923, and was for a period of ten years "or longer as he (the lessee) sees fit." It was therein provided that Arnett had the right to remove at any time the buildings he might erect.
After the judgment had been reversed, the appellants filed this suit against Arnett alleging their ownership of the property and asking damages for its wrongful detention and trespass and for rent during the period *Page 769 which had elapsed since he had entered upon the premises. By amended petition it was charged that Arnett had removed and was threatening to remove the buildings which had been erected, and that he had accepted the lease and improved it with full knowledge of the pending litigation over the title. In one of the amendments, filed September 10, 1927, it was recited that since the filing of the suit, the defendant, Arnett, had instituted a suit against the plaintiffs asking for a lien on the property to secure him for the expenditures incurred in enhancing the value of the land by reason of the improvements and that the same matters in issue in this suit were set up in that one. It was asked therein that that suit be abated and dismissed or consolidated with this one. During the pendency of this action, on September 25, 1928, the plaintiffs also filed a motion to consolidate the suits. There is no order of consolidation contained in the record before us, but on May 2, 1929, the date of the judgment, two orders were entered setting aside the submission of this case and the order of consolidation of the two cases. The judgment expressed the opinion of the court that the rental value of the property did not exceed the value of the improvements placed thereon by the defendant or the amount of the enhancement in value, and it was adjudged that the petition and "the counter claim of the defendant for improvements" be dismissed, the parties to pay their respective costs.
The principal ground urged for a reversal of the judgment is that the plaintiffs were entitled to a judgment upon the pleadings as the defendant never filed an answer in this suit. Until the very day of the rendition of the judgment the other suit had been consolidated with this one and proof had been taken upon the enhancement in value of the property as well as to what was the reasonable rent for the period of occupancy. The pleadings in this consolidated action formed the issues in this case, and the petition in the other case was regarded by the court as a counterclaim for the enhancement in the vendible value of the property. The appellant had by two formal prayers asked for the consolidation and all parties considered the union as consummated. It is the established rule that where both parties treat an issue as joined and the case is submitted on the merits without objection or a motion for a judgment on the pleadings, this court will likewise regard it even though the responsive pleading was not formally filed in fact. To *Page 770 consider it otherwise would be to sacrifice substance to form. Nieten v. Kimsey, 177 Ky. 817, 198 S.W. 203; Davis v. Kimberlain, 188 Ky. 147, 221 S.W. 226; Carter Coal Co. v. Bays, 183 Ky. 29, 208 S.W. 1; Rosa v. Nava, 235 Ky. 574, 31 S.W.2d 910.
On the merits of the case it was shown that after the rendition of the judgment in the circuit court, which was not superseded, the appellee, Arnett, had made inquiry of the circuit judge as to the power of Mrs. Montgomery to lease the property and was advised by him that she had that power and that he would be safe in making the contract. He otherwise further showed his good faith in executing the lease and entering into the possession of the property. It is the rule that a bona fide purchaser or occupant who places valuable improvements upon land under the good-faith belief that his title or right is good may, as against another person subsequently adjudged to be the true owner, have a lien on it to the extent that the improvements have enhanced the vendible value, not to exceed their cost. Pierce v. Pierce's Trustee,238 Ky. 495, 38 S.W.2d 254. And it is further held in considering the question of good faith that one may rely upon the judgment of a court possessing jurisdiction of the subject matter. Leonard v. Williams, 220 Ky. 413, 295 S.W. 408; Fox v. Faulkner, 222 Ky. 584, 1 S.W.2d 1079. This resisting equity which the occupant has "is a shield and not a sword," and consequently it will not support an affirmative action against the true owner of the property. It does entitle him to retain possession until he has been paid for the enhancement in the vendible value of the property or until a lien has been adjudged in his favor as a condition of granting the relief sought against him by the true owner. Hall v. Hall, 236 Ky. 42,32 S.W.2d 536. Such claim may be set up as a defense to a claim for rents and trespass. Siler v. Carpenter, 155 Ky. 640,160 S.W. 186.
In this case the evidence as to the value of the improvements and as to the rental value of the property was conflicting, but we have no difficulty in concurring in the opinion of the chancellor that the one counterbalances the other.
It follows, therefore, that the judgment should be, and it is, affirmed. *Page 771