Only a few times.
Once in high school I told two friends that I measured and they didn't believe me and just decided I was a different, smaller but still big, size. I didn't fight them on it, but they both assumed that one of them was larger because he was so tall. I saw his penis a couple years later and he was clearly big, especially thick, but I was bigger.
Once in college I was having a drunken sex talk with a couple of roommates. We were talking about things we had done and what we wanted our respective girlfriends to do. We talked about titty-fucking, I wish there was a name for that that didn't sound so immature, and I mentioned that its even better to have your cock between her tits while she sucks the head. My friends didn't believe that was possible even though it was something I had experienced a few times. They stayed pretty quite afterwards, but when I explained the logistics they just kind of nodded.
Another time in college I was driving a group of people to the bar. In the passenger seat was one of my roommates when I lived with three women. She was beautiful and I still think about her frequently, though, I'm sad to say that we were never intimate despite all of my efforts. My old roommate, a guy, was in the backseat with two friends, both women, of my roommate at the time, the woman who was in the front with me. I heard them say a number that corresponded to the length of my penis, and in a stupid horny haze said something about "telling secrets." When my roommate asked what I meant I told her "my penis is X inches long." It did not get the reaction I wanted at all and my face is turning red with embarrassment now just remembering it.
I remember telling that last story to a friend in a bar one night. I explained how thinking about it brought me such shame that I could feel the heat in my face and I was trying to spark a conversation about things that bring about that level of shame. He took it a different way and started prying me to tell him my size, and he ended up taking guesses which I did not respond to, at least until he said four inches and I explained that I wouldn't be bragging to a woman about that. He said that he was "seven and change" in an attempt to get me to open up, but I didn't tell him.
All my other experiences of friends knowing my erect size happened when I was too young to discuss.