You need to swap the order on one side of the $=$. If you have a vector in the $a$-basis, transforming that via $A$, and then change basis would be signified by $M_TA$, while first changing basis and then transforming via $B$ would be $BM_T$. Those are the ones that are equal, and they both express the transformed vector in the $b$-basis.