In an action brought to determine adverse claims to real estate, under the provisions of this chapter, affecting real estate upon which permanent improvements have been made by a plaintiff, or those under whom he claims, holding under color of title adversely to the claim of a defendant or intervenor, in good faith, if such plaintiff is unsuccessful, the value of such improvements must be allowed as a claim in favor of such plaintiff. In order to be entitled to maintain such claim, said plaintiff, either in his original complaint, or by amended complaint, must set forth, among other things, the value of the land aside from the improvements thereon, and also as accurately as practicable the improvements upon the land and the value thereof. In such case, said action shall proceed as provided in § 21-41-15.
SDCL 21-41-22