A teenager witnessed a friend being fatally stabbed on a beach, as described in court.