This is clearly not illegal. As others have said there is no requirement in law for right or left seat. The same applies to tandem and the front and back debate. I often fly from the 'wrong' seat.
This is fine when dual but many tandem aircraft will require you to solo from either front or back for W+B purposes.
Wouldn't advise swapping over with a friend if you don't fully brief. Two people trying to control an aircraft at the same time might just lead to one unhappy outcome.