As long as you haven't redeemed the code yet, you can just send your friend the email you received or the number and they can redeem it. They aren't typically locked to hardware.
Not sure it's strictly allowed in the terms, but I've never had a problem gifting my friends codes for games I already owned.