Talk to the company B lawyer ... or hire one to represent you personally.
IMMIGRATION LAW PROFESSOR for 10 years -- LEGAL DISCLAIMER: This answer is offered for informational purposes only. It does not constitute an attorney-client relationship.
You must wait for the company A petition to be approved before filing for change of employer. You should speak with an experienced U.S. business immigration attorney about your options.
Robert K. D'Andrea, Attorney at Law
D'Andrea Law Corporation, PLC
Legal Disclaimer: This answer above is general in nature and is offered for informational purposes only. This does not constitute an attorney-client relationship. You should retain an experienced U.S. immigration attorney to review all the facts of your case in order to receive specific advice.
Since you are already in H-1B status, you have already been counted against the cap once. You are now no longer counted against any cap. Thus, you can now have Co. B file a new H-1B petition on your behalf ASAP.