When a defendant in equity in his answer alleges new matter constituting a claim to affirmative relief, the case shall be decided upon the same principles, and the same relief shall be decreed in the case, as if a crossbill had been filed to obtain such relief.