Friendship can counteract trauma, study finds