No you can not work for company A as an independent contractor (or as a regular employee for that matter). You may only work for the H1-B sponsor. What can happen is that company A can buy your services from company B (i.e., they pay B and B would pay you as their employee).