If it is not a futures market, the transfer of the sales contract should be agreed by the other party to the contract.
But in fact, the speculator (B) can also sign another sales contract with C. When the contract expires, B gets the goods from A and sells them to C. That's all.