As the title said, true friends won't mind that. But wonder why you touched the hair of your friend? Are you saying something at the same time?
I saw my friend today and realized that his hairstyle changed, and I touched it. Is it rude to touch my friend's hair?
it is not rude because he is your friend
YES ... It IS rude to touch anybody without their permission.
Friend or not.
Just because you think you are friends, does not mean THEY think so ... Let alone that friendship gives you the right to touch them. Some people are uncomfortable with others touching them, no matter whether they are friends or not.
The polite thing to do is to ask before you touch anyone.
personally i don't think its THAT rude. Its not a huge invasion of privacy, you're just noting on it. And if it made him look uncomfortable or provoked a comment, then you can just apologise, move on and not do it again. But if you guys are friends, you're close, it's fine. Not even a problem.