Hi,
The other way of doing this is as under :-
1) Pass a sale entry for Class A
2) Pass a purchase entry for Class B
3) Route both these transactions through a Dummy Bank Account, as your actual bank accounts will not be hit.
In this way your gain / loss entries for Class A can be determined and posted in the books of accounts.
Warm regards,
Akhil Poddar