LDAP Group Restrictions

I want to achieve that for example, User A from company A, cannot see User B from company B especially when searching in the global directory of users.

The only solution I can think of, would be to deploy a chat server per sub company, but this would take up some fair resources.

Thanks for any ideas/suggestions you might have!