Very good question. From a legal perspective, under most US jurisdictions whenever a director, officer or a controlling shareholder is on both sides of a transaction, the "duty of loyalty" such person owes to the company is implicated.
In such cases, other shareholders can challenge and reverse any transactions unless:
For the most part, the solution is disclosure, disclosure, and more disclosure. Disclose all the details of the relationship to the boards of both companies, and have a vote of the disinterested directors approve the relationship (i.e., if you are a director of either company, don't take part in the deliberations or the vote, and have anyone else who might have an interest in the transaction abstain, too).
If it is an "optically" tricky relationship, such as if the hired company is charging a rate that is out of line with the competition, or something else that makes it seem like it may not be entirely fair (even if it is), then you may want a corporate lawyer to consider the details.
Different standards apply to people based on whether they are controlling shareholders, directors or officers and other factual circumstances. Being able to demonstrate the fairness of the transaction is particularly important if you are a controlling shareholder in either company.
That's what the law requires, but it is also good common sense. If you avoid giving the appearance of impropriety by making sure that everyone understands all the details of the transaction, have it approved by the disinterested directors, and make sure the transaction is fair to everyone involved, then you should avoid any problems.
(The above does not constitute legal advice nor does it create an attorney/client relationship between us)
The essential steps are (1) disclose all material facts, including your involvement, to the appropriate people in both companies, then (2) have those appropriate people provide their consent in writing before the transaction proceeds.
This issue is discussed in a similar context - a transaction between a corporation and one of its directors - in Can a Corporation Enter into a Business Transaction with One of its Directors? Disclaimer: This information does not constitute legal advice and does not establish an attorney-client relationship.
Its not just the partners. Depending on your stake of ownership in both (and others, if there are additional shared owners), they may be considered related before the law (especially tax law), making the transactions between them problematic.
In the United States, the Federal law identifies these situations, commonly called as "controlled group":
This is defined by the IRC section 1563.
Corporations that are part of the controlled group may have limitations on losses in transactions between them, might be required to submit combined tax returns and financial statements, etc.
Talk to your CPA if you think this may be relevant to you.
You may wish to consider forming a joint-venture for the work, it will state out implicitly what work is to be done, how, and by whom. It is treated as a separate legal entity for the issues of transactions. Talk to a lawyer about it and the topic of your position in both companies. Otherwise, you had better hope everyone likes each other ALOT, if not you are asking for a serious head ache if/when relationships go south.