To understand linear algebra well and get elegant notation, it is useful to write scalars on the right (when they multiply vectors), at least when writing functions and transformations to the left of their arguments (and composing in standard way from right to left). Doing so, it is useful to think of $n$-tuples of vectors (such as bases in an $n$-dimensional space) as row matrices with $n$-columns, and to allow these $n$-tuples of vectors to be multiplied on right by matrices of scalars having $n$ rows.
For any $m$-tuple $U = (u_1, \dots, u_m)$ of vectors (a row matrix of $m$ vectors) and basis $W$ on an $n$-dimensional space, define $U_W$ to be the $n \times m$ (scalar) matrix such that $U = W U_W$ (it actually would be somewhat more logically coherent to write ${}_WU$ rather than $U_W$, but left subscripts are problematic typographically). Identifying $1$-tuples of vectors with vectors, if $u$ is a vector we also write $u = W u_W$, where $u_W$ is a column matrix. As one would expect since the $j$-th column of $U=WU_W$ depends on the $j$-th column of $U_W$, the $j$-th column of $U_W$ is ${u_j}_W$. Also notice that if $V$ and $W$ are bases, $V = W V_W = (V W_V)V_W = V (W_V V_W)$; this forces $W_V$ to be the inverse of $V_W$.
For any $m$-tuple $U = (u_1, \dots, u_m)$ of $u_i$ in the domain of a linear transformation $T$, let $T(U) = (T(u_1), \dots, T(u_m))$. If $T$ is a linear transformation from a space with basis $V$ to a space with basis $W$, then $T(x) = T(Vx_V) = \text{(by linearity) } T(V)x_V = W T(V)_W x_V$. So $T(V)_W$ is the matrix ${}_WT^V$ of $T$ with respect to the bases $V$ and $W$. Notice ${}_WI^V = I(V)_W = V_W$.
Suppose $V$ and $W$ are bases of the same $n$-space, and $\phi$ a linear operator on that space. We have $\phi(V) = V\phi(V)_V$ (because $\phi(V)$ is an $n$-tuple). Plugging therein $WV_W$ for a couple instances of $V$, we get $\phi(WV_W) = WV_W\phi(V)_V$. But by linearity $\phi(WV_W) = \phi(W)V_W$. Thus, $\phi(W)V_W = WV_W\phi(V)_V$. Multiplying on the right on both sides by $(V_W)^{-1}$ gives $\phi(W) = W V_W\phi(V)_V {V_W}^{-1}$. But we know that $\phi(W)$ also equals $W \phi(W)_W$. Since $\phi(W)_W$ is uniquely determined by this equation, $\phi(W)_W = V_W\phi(V)_V {V_W}^{-1}$. Recall that the matrix $V_W$ is the matrix whose $j$-th column is ${v_j}_W$, where $v_j$ is the $j$-th element of the basis $V$. One may calculate its inverse directly or use that ${V_W}^{-1} = W_V$. Using your notation, we have $V=(a, a'), W=(b, b'), A = {}_V\phi^V=\phi(V)_V, B = {}_W\phi^W=\phi(W)_W, X = V_W$.
Notice that given a standard (or otherwise) basis $E$, one has $V = E V_E = W E_W V_E$. So $E_W V_E = V_W$. (Notice that if we had used left subscripts, on the left side of this equation we would have ${}_WE {}_EV$, and canceling the $E$'s suggestively would yield ${}_WV$, as desired, but one can't do that with right subscripts or the matrices get multiplied in wrong order---a price to pay for writing linear transformations on left.) Thus $V_W = {W_E}^{-1} V_E$, and so one may readily calculate $X = V_W$ if one knows $W_E$ and $V_E$. Suppose in your case that $E = (e_1, e_2)$. If $a = e_1 a_1 + e_2 a_2$ and $a' = e_1 a'_2 + e_2 a'_2$, then ${(V_E)}_{i1} = a_i$ and ${(V_E)}_{i2} = a'_i$. Similarly with $W_E$ and $b, b'$.
Is it required to write this separately? Or is it equivalent in the form of my previous comment?
– Understand Mar 08 '15 at 10:12