I have an item I invented over 5 years ago. I assume it would be considered a "design-patent" since what I have invented is a new design on an old item. The item (design) has never been published in any media or made for sale to the public, however I did sell one to a friend and I have shown it to some people. I have 4 prototypes in my possession and am in the process of meeting with an engineer to design a mold for manufacturing.
Normally, there is an "on sale bar", so one year after a sale you can't file for a patent. But your situation seems to potentially have some nuance (sold to a friend -- was the friend under a non-disclosure obligation? was it really a sale or did you provide it at cost? was it for testing? etc). I'm not too optimistic about the chances, but it is worth talking with a licensed patent lawyer to get a definitive answer.
I like Gary's answer, but have this concern: the problem may be less your disclosure/sale to your friend(s) than any disclosure(s) made by the friend(s) to others. The fact these disclosures happened potentially weakens any patent you may be granted, and may lessen any royalties or damages you may be able to claim. If your friend showed the product you sold him anywhere you're probably out of luck.
If you apply for a patent you'll have to sign an oath, and any inconsistencies there can carry jail time, loss of patent, and enormous monetary damages. Be careful :)