ROS2 C++ - How to make a subscriber subscribe to two topics synchronously

Each ros::Subscriber subscribes to one topic and has one callback function. You can create as many subscribers as you need. The callback functions can be regular functions or class methods. For more details, see the ROS Subscriber API.