You don't. You DID sell shares ("check sent" ... that check/cash had to have come from somewhere).Your cost basis DOES change, as you've described the scenario. That you never had your hands on the check is immaterial ... as your agents (the 401k trustee and the IRA trustee) DID have the cash.