Faith groups to be given freedom to host same-sex weddings