Is it true that wasps don't sting if struck by hand while flying? I know of one person who claims to have done this at least 20 times and has never been stung. And out of curiosity (not that I'd want to kill them), what about bees?
I think what your friend advised is incorrect, or they are very lucky. According to "Bee and Wasp Stings" from the University of California Davis, they specifically state:
Also, if you swat at some species, they are likely to become agitated, making the situation potentially far worse.
I can confirm that I have often enough slapped a wasp or bee in flight without being stung. The reason is probably pure chance.
It is kind of like asking if a human can bite when slapped. If I come up to you and slap you, fast and hard, your will probably not be able to bite my hand because of surprise and the blinding speed with which I hit you. If, however, you happen to be talking to me and have your mouth open at the time, you might be able to pull off a quick bite.
In a similar vein, if I happen to swap a wasp (no anagram intended) and hit it on the sting, I will probably be stung. If I hit it on the side and move fast enough, I doubt it will have the time to reorient itself and sting me before my hand is gone.