There's a difference between your friends and people you treat in a friendly manner.
Part of it is boundary issues, you place a boundary further out from people you treat friendly than you would your friends.
Boundaries are healthy to a point, but they can be a crutch too.
If we don't set boundaries, we can compromise our character.
If we set them too far out, we can nullify the effectiveness of our character to influence others positively.
There is wisdom to learning when to treat people friendly, and when to call them your friend.
Sometimes, a little intentional placing of faith in someone you pretty sure doesn't deserve it but you do it anyway because you want to call them your friend can go a long way toward creating a better world. I think this is especially true in places where society forces us to be friendly without being friends, like work.