Temperature is easy to define for closed systems. By definition, for closed systems (or systems with negligibly small interaction with the environment) temperature is (see Chandler, for example) $$ \frac{1}{T}\equiv\left(\frac{\partial S}{\partial U}\right)_{V,N},\tag{1} $$ where $V$ is the volume, $N$ is the number of particles, $U$ is the energy and $S$ is the entropy of the system.
One can prove that two noninteracting (or rather weakly interacting) systems at thermodynamic equilibrium have the same temperature using the principle of maximization of entropy. The principle says that when the total energy $U$, number of particles $N$ and volume $V$ are fixed for the composite system, the total entropy is maximized at equilibrium. The proof of equal temperatures is very simple. At equilibrium the entropy is at maximum, and therefore, if we transfer small amount of energy $\delta U$ from one system to another, the total change in entropy is going to be zero: $$ \delta S=\frac{1}{T_1}\delta U_1+\frac{1}{T_2}\delta U_2=\left(-\frac{1}{T_1}+\frac{1}{T_2}\right)\delta U, $$ which is true only for $T_1=T_2$.
My question, for interacting systems, where the total energy is expressed as $$ U=U_1+U_2+U_{12},\tag{3} $$ where $U_{12}=f(U_1,U_2)$ is the interaction energy, is there an accepted definition for temperature?
Note. The temperature cannot be defined as $$ \frac{1}{T_1}=\left(\frac{\partial S_{tot}}{\partial U_1}\right)_{V,N},\tag{4} $$ with $S_{tot}=S_1+S_2+S_{int}$, because with such definition, since $\delta U_1 +\delta U_2=-\delta U_{int}\neq 0$, the temperatures of both systems are not going to be equal at maximum entropy.
Personal idea. I am not sure if this way is a proper one, but here is my idea. We could define temperature through a tunable turn-on-off of the interaction. We could imagine that interaction between two systems is governed by a parameter $\lambda$. The value $\lambda=0$ corresponds to the no interaction case, and $\lambda=1$ corresponds to the full interaction. The interaction energy would be then a function of $\lambda$ (probably a monotonous one): $$ U_{int}=f(U_1,U_2,\lambda). $$ This relationship can be inverted: $$ \lambda=F(U_1,U_2,U_{int}).\tag{5} $$
The total entropy is a function of $U_1$, $U_2$ and $\lambda$ $$ S_{tot}=G(U_1,U_2,\lambda). $$ Expressing $\lambda$ through $U_{int}$ from Eq. (5), we obtain that $S_{tot}$ is a function of $U_1$, $U_2$ and $U_{int}$: $$ S_{tot}=S(U_1,U_2,U_{int}). $$ The temperature would then be defined as $$ \frac{1}{T_1}=\frac{\partial S}{\partial U_1}.\tag{6} $$ With such definition, the variation of $S_{tot}$, $$ \delta S_{tot}=\frac{1}{T_1}\delta U_1+\frac{1}{T_{2}}\delta U_2+\frac{1}{T_{int}}\delta U_{int} $$ is zero for the fixed total energy if $T_1=T_2=T_{tot}$ (this is not the only solution though). In other words, with the above definition of temperature, the equal temperature of different parts of the system is consistent with maximum entropy at equilibrium.
Does anyone know if anyone introduced temperature for interacting systems in the literature?