The $\pi\gamma \to \pi\pi$ transition and the $\rho$ radiative decay width from lattice QCD