German industrial group Siemens and French rival Alstom agreed to merge their rail operations.