German parties reach deal for government to end Merkel era