That was silly. Be sure not to do that again. What made you buy eShop games on your friends console? Where you just trying out the WiiU?
If the download code is unused then you can still use it.Does download code makes any difference?
Do this instead.Buy one for your friend and keep the one with your games on