Quasi-Hermitian operators in quantum mechanics and the variational principle