Obviously you will need find pointer to object that you want to communicate, study API reference:
Theres also offline version of it in /Engine/Documentation/CHM which i think it easier to work with. Lot of classes got pointers to various objects, so check AHUD:
For example if your bool is in pawn (let say AFPSPawn) possesed by player controller you can do something like this from AHUD:
If it’s not hud but some random custom class you’ve created then you just use c++ basics. There are no special requirements by UE for general c++. As soon as you use object of that class type you can always get access to its public variables.
For hud case: there are multiple ways to get it. You have HUD assigned to your Player Controller. You should just get a pointer to proper PC object and get its HUD like this (as example):