For linear operators $A,B$ acting on $\mathbb{C}^n$ the fact that $\text{tr}(AB)=\text{tr}(BA)$ follows from the cyclic property of the trace, which says more generally that if $A,B,C$ are linear operators acting on $\mathbb{C}^n$ we have that $$\text{tr}(ABC)=\text{tr}(CAB)=\text{tr}(BCA)=\text{tr}(ABC).$$
My question is whether there are specific conditions on $A$, $B$, and $C$ such that $$\text{tr}(ABC)=\text{tr}(BAC)?$$ Clearly, its true if $A$ and $B$ commute, but its also sufficient for either $A$ or $B$ to commute with $C$, but are these necessary for this property to hold?
I should mention that I am primarily interested in the case that $A,B,C$ are invertible, since clearly if $A,B,C$ have zero divisors the property can be satisfied in a trivial sort of way.
Given $C$ and $A$, $$\varphi(B) = \text{tr}(ABC) - \text{tr}(BAC) = \text{tr}(B (CA-AC))$$ is a linear functional on $M_{n\times n}(\mathbb C)$, and if not identically $0$ it is $0$ on a linear subspace of $M_{n \times n}(\mathbb C)$ of codimension $1$. Thus for any $B_1$ and $B_2$ with $\varphi(B_2) \ne 0$, there is some $t$ such that $\varphi(B_1 + t B_2) = 0$ (namely $t = -\varphi(B_1)/\varphi(B_2)$).