If an AI unit is facing another unit of the same side it will automatically become aware of that unit as long as it is within spotting distance. It does not matter if there are obstacles (eg. walls or buildings) in the way.
Video highlighting the issue: