A 19-year-old was shot dead while sat on a wall with a female friend, a court hears.