The president and the nation have evolved on same-sex marriage