A quantum theory of Wheeler-Feynman electrodynamics