The paper studies the problem, for which continuous functions f on the real line R, the difference of the functions f(B)−f(A) of self-adjoint operators A and B with trace class difference must also be of trace class. The main result of the paper shows that this happens if and only if the function f is operator Lipschitz on a neighbourhood of zero.