If the defendant intends to claim allowance for improvements made upon the premises by himself or those under whom he claims, he shall file with his plea, or at a subsequent time before the trial (if for good cause allowed by the court), a statement of his claim therefor, in case judgment be rendered for the plaintiff.