QM before Xmas: squares of operators

Under which condition follows \(A^2\psi = B^2\psi\) from \(A\psi = B\psi\) with a wave function \(\psi\) and two operators \(A\) and \(B\)?