Your friend gives you an envelope containing an unknown amount "x". He says the second envelope contains either double or half the amount in the first envelope.
Your friend has not stated what the odds are, but it would seem a reasonable assumption that you have a 50/50 chance of either result.
The expected value of cash in the second envelope is 0.5*(2x) + 0.5*(x/2) = 1.25x
So if this process was repeated 10 times, and x was $1000 each time, if you switched every time you would expect to come out with $12500, as opposed to $10000 if you stuck every time.
It makes no difference what the value of x is, if you switched every time, you would in the long run always come out with 25% more than if you didn't switch.
Now, here's where the second argument falls down:
You are no longer dealing with a random value x. The problem has been limited to only 2 possible values, a and b. You have a 50% chance of picking either.
If the first envelope you pick contains a, you can't switch to get 2a or 0.5a, you can only get b.
If you pick b and switch, you can only get a.
The expected value is 0.5a + 0.5b.
In this case, as b=2a, the expected value is 0.5a + 0.5 * 2a = 1.5a. So if a=$1000 and the situation was repeated 10 times, you would expect to come out with $15000 regardless of whether you switched or not.
It is placing this limitation on the initial possibilities that changes the problem, and the final result.