Suppose I have a wavefunction into which I insert the completeness relation of some discrete basis as
$$ \psi_\alpha(x)=\langle x|\alpha\rangle=\sum_k \langle x|a_k\rangle\langle a_k|\alpha\rangle=\sum_k u_k(x) c_k~~. $$
The $u_k(x)$ are called the eigenfunctions of operator $\hat A$ if
$$ \hat A|a_k\rangle=a_k|a_k\rangle~~. $$
To show that the $u_k(x)$ are indeed eigenfunctions, I multiply the eigenket equation from the left with $\langle x|$ to get
$$ \langle x|\hat A|a_k\rangle=\langle x|a_k|a_k\rangle=a_k\langle x|a_k\rangle=a_k u_k(x)~~. $$
To show that $u_k(x)$ is properly an eigenfucntion, I need to bring $\langle x|$ to the right of $\hat A$ in the leftmost expression as
$$\langle x|\hat A|a_k\rangle=\hat A u_k(x)~~.$$
How do I know that I can do that?