I'm still looking for a pic for you, but late war aircraft like the P-51D and P-38L sometimes carried a system that would alert the pilot if an aircraft passed behind them. Both an audible warning and a light on the control panel. Was called the AN/APS-13.
However this would usually go absolutely haywire in formations and was usually removed or unhooked. About its only use was to tell the weaver or tail-end charlie that he was about to get his butt shot off.