STEWART, Justice. In its amended and substituted petition appellant, plaintiff below, alleged, in substance, that it is the owner of the fee simple title to and in actual possession of two certain tracts of land in Whitley County, each of which was fully described and one of which was designated as 'Tract No. 1' and the other as 'Tract No. 2'; that both tracts were acquired by purchase for a valuable consideration by the Pine Mountain Railroad Company from Elijah Smith and his wife, Rhoda Smith, the father and mother of appellee, by deed dated July 18, 1907, which was duly recorded on July 26, 1907; that the Pine Mountain Railroad Company conveyed the same property to appellant by deed dated April 1, 1913, which was duly recorded on May 24, 1913; that upon the execution of the deed of July 18, 1907, appellant's predecessor in title took possession of the whole of the two tracts of land and constructed thereon a railroad; that both tracts of land had been in the actual, peaceable, exclusive, continuous and uninterrupted possession of appellant and its predecessor in title since the execution of the deed first above mentioned of July 18, 1907; that appellant and its predecessor in title has held, occupied and used the property under a claim of right and ownership and adversely to appellee and all the world from July 18, 1907, until the present; that each and every year since the execution and delivery to it of the deed on April 1, 1913, appellant has caused the two tracts of land to be assessed for taxes and has paid the taxes on the same; that Elijah Smith and Rhoda Smith, grantors in the deed of July 18, 1907, died intestate in January, 1928, and December, 1935, respectively; that in a partition suit, to which appellant was not made a party, the lands of Elijah Smith and Rhoda Smith were divided in kind in July, 1937, and a portion of the two tracts of land in litigation was included in the division deeds; that appellee asserts title to a portion of the two described tracts by inheritance and under deeds made to him by the other heirs of Elijah Smith; and that the said claim of appellee from and through his parents is from a common source to the title of appellant and is without right or authority of law. Appellant prayed that its title be quieted to the two described tracts of land and that appellee be required to release unto appellant all claims thereto.
Two exhibits were filed as a part of the foregoing pleading. 'Exhibit A' is a copy of the conveyance of the two tracts of land described in the petition from Elijah Smith and Rhoda Smith to the Pine Mountain Railroad Company, duly authenticated by the clerk of Whitley County, which shows on its face that it is a general warranty deed, that the consideration paid in cash for the two tracts of real estate described therein was $1600, and that the said land was 'purchased by the second party for the purpose of constructing and operating thereon a railroad and facilities appurtenant thereto'. 'Exhibit B' is a copy of the conveyance from Pine Mountain Railroad Company to the Louisville and Nashville Railroad Company, duly authenticated by the same clerk, which discloses that Pine Mountain Railroad Company conveyed with special warranty the same two tracts of land, together with other property, to the Louisville & Nashville Railroad Company for a valuable consideration, all 'to be used for the purposes of or in connection with the lines of (appellant's) railroad or the maintenance or operation of any part thereof'.
Appellee in his answer and counterclaim to the petition, after admitting that the deed of July 18, 1907, had been executed and delivered to the Pine Mountain Railroad Company and after disclaiming any interest in Tract No. 2 described in appellant's pleading, averred, so far as we need consider here, that a railroad had been constructed on only a portion of Tract No. 1, set forth in the petition, and that he asserted ownership only to the part of this tract which he contended the railroad had never taken over, occupied and used for railroad purposes. In addition, he alleged, with reference to the portion of Tract No. 1 claimed by him, that the deed of July 18, 1907, did not truly evidence a voluntary sale but was executed in obedience to judgments in condemnation proceedings had in 1906 and in 1907 in the Whitley County Court and that, for this reason, an easement only was conveyed by said deed. Further pleading, he alleged that by inoccupancy and by nonuser on the part of the railroads of the land in controversy since its conveyance as aforesaid it had been abandoned by appellee and its predecessor in title and it had reverted back to Elijah Smith, now deceased, from whom appellee had inherited an interest in it and from the heirs of which decedent he had purchased the remaining interests therein. He also pleaded that he had acquired title by adverse possession to the portion of Tract No. 1 claimed by him, maintaining that he and his predecessors in title had been in continuous possession of it at all times since July 18, 1907. Appellee asked that his title be quieted and that he be adjudged the owner in fee simple of the tract of land in litigation.
Appellant filed a general demurrer to the answer and counterclaim, and, without waiving its demurrer, filed a reply thereto. The lower court overruled appellant's demurrer to the answer and counterclaim, carried the demurrer back to appellant's amended and substituted petition, and sustained it as to the petition. Appellant declined to plead further and judgment was entered dismissing the petition.
Appellant contends, as the outset, that reversible error was committed by the lower court in sustaining the demurrer.
While the record does not disclose the ground upon which the demurrer was sustained to the petition, counsel for appellee base their entire argument in their brief in support of the circuit court's action in this respect upon allegations contained in appellee's answer and counterclaim, and they pass over the issue as regards the determinative fact in this case, which is the sufficiency of the petition when it is considered along with the exhibits filed therewith.
Although it is generally true that a demurrer searches the whole record, this rule does not authorize the court to consider subsequent pleadings or parts thereof not embraced in or not in relation to the pleading to which the court finally directs the demurrer. Therefore, the defenses appellee relies upon to defeat appellant in this action which appear only in his answer and counterclaim, cannot be looked to in measuring the sufficiency of the amended and substituted petition. Smith v. Harris, 276 Ky. 529, 124 S.W.2d 786, and Broughton v. Louisville & N. Ry. Co., 217 Ky. 297, 289 S.W. 237, 238. The law on the point under discussion is succinctly stated in the Broughton case in these words: 'When the court, in searching the record, carries a demurrer to the answer back to the petition, and sustains it, then it is the same as if the demurrer had been filed by the defendant to the petition at the outset. The answer is, under such circumstances, not considered, and it is the same as if it were non est.'
Appellant alleged in effect in its amended and substituted petition that it had both the legal title to and possession of the land in litigation and that appellee was setting up an adverse claim to this property. Exhibit A, a verified copy of the deed from Elijah Smith and Rhoda Smith, his wife, to the Pine Mountain Railroad Company, revealed that a fee simple title had been conveyed, with the result that this deed did not contradict, but instead confirmed, the allegations of the petition. Nor did Exhibit B militate against this pleading. We are therefore of the opinion that appellant's petition stated a cause of action. See KRS 411.120.
In view of our decision herein it becomes unnecessary to consider the other grounds urged by appellant for a reversal of the judgment.
Wherefore, the judgment is reversed with instructions to the trial court to overrule the demurrer to appellant's amended and substituted petition, and for further proceedings consistent with this opinion.