They both would. Any Pokemon that gained experience points from a Pokemon gains EVs; so both Pokemon would get the EVs.