Quantum formulation of the Einstein equivalence principle