Yes, correct in both, and it is becoming more and more formally acceptable (it has been informally so for some time), because we have no other adequate pronoun for a third person singular human being of unspecified ***. In your second sentence it may seem a little strange, I think, because presumably the interlocutors would know what *** the friend is.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.