This situation is also known as inter - company loans / payments. Section 109K of Income Tax Assessment Act 1936 (ITAA 1936), states that a private company is not taken to pay a dividend because of a payment or loan to another company.
A situation like the above can frequently occur between two companies in a related group where there are numerous transactions between the two and share of resources.