Suppose the following hypothetical situation occurring within the United States of America.
Startup Sam wishes to contract Contractor Bob to invent a widget. Startup Sam and Contractor Bob agree, and state on their contract, that Startup Sam will own the intellectual property rights to the widget upon completion of the project.
Unbeknownst to Startup Sam, Contractor Bob is currently employed by Company X. As part of the terms of employment, Contractor Bob agreed to an intellectual property clause which states that Company X will own the intellectual property of all inventions by Contractor Bob (whether or not they were produced on or off company hours/premises).
In this scenario, would Startup Sam still own the intellectual property rights to the widget invented by Contractor Bob, or would Company X own it?