If a system of two objects is isolated from the environment by keeping it inside a heat resistant box, then no energy can leave the box or enter the box.
In this situation, heat energy lost by the hot object = heat energy gained by the cold object.
In due course, the two objects attain the same temperature. This is called Principal of Heat Exchange
Principle of heat exchange is used in the calorimetry method to determine the specific heat capacity of a substance