Brain-monitoring helmet could help tell friend from foe