Yes, but it is not usually easy and it helps more often than not, if one or both are already in a relationship or not the others type.
I have had a fair few female friends, those whom I were close to I inevitability developed an attraction to, and those whom I weren't close to I drifted apart from after a while. That's probably more due to my solitary nature though.
It is largely circumstantial in my opinion.
Although none of my friends in relationships have female friends, largely I believe due to the overbearing jealousy of their girlfriends. Hell, one of them wouldn't be allowed to a girls house without his partner even if there were other guys/girls there.