Yes. Or, you could be the person who gave B to get A.
Your second example is a little redudant. You trade or you exchange.
"Trade" has a sense of things being equal. If you return something that isn't working to the store where you bought it and get a new part that does work, you exchange it.