The temperature that enters in the denominator of the integrand in the Clausius inequality is the temperature of the external thermal reservoir with which the system exchanges heat. At each instant of the process, the system is in contact with an external reservoir.