You absolutely can. And may we just say, you're a pretty great friend!
Your friend should make sure to use the referral link to come to the site rather than clicking on the Activate link in the gift card email they've received. If your friend is purchasing a device, they'll have a chance to enter the gift card details in the purchase process. If your friend is bringing a device to Madstar Mobile, they can apply the gift card separately as a credit on their account or they can save it for another time when they want to purchase a device.