Electron trapping and acceleration by the plasma wakefield of a self-modulating proton beam