A Swansea man has been sentenced to two years in jail after pleading guilty to vehicular homicide for a crash that killed his friend.