It wouldn't count as prior art for the purpose of invalidating the patent unless his idea was in some way identifiable during a reasonable search for prior art. From a legal perspective, prior art is usually interpreted as the available information about the thing being patented. If your friend told you about it over drinks at a bar, that's not prior art. For that matter, trade secrets for even very old things aren't prior art either because the information is not available. If your friend wrote a blog post that hit the mainstream media, or at least the front page of HN, it gets to be a bit of a grey area.