Walī is not simply any friend or attendee, but the legally entitled guardian whose position is established by the relevant rules of kinship and guardianship.
This status matters especially in the exceptions regarding repetition of the prayer after another person has led it.