Detecting gravitational waves with a heralded-photon quantum eraser