You can do this pretty easily with an auto-continue breakpoint at A and commands on breakpoint B. In the simplest approach, the breakpoint on A would look like:
break set <HoweverYouSpecifyA> --auto-continue 1 -N BreakpointA
Then the breakpoint on B would be:
break set <HoweverYouSpecifyB> -C "break list BreakpointA" -C "break disable BreakpointA" --one-shot
The break list BreakpointA output will show the hit count of A when you hit B, which is what you wanted to know. By disabling A when you hit B, the hit count for A will stay what it was when you hit B, so you should be able to check it at any point after that (till you rerun).
I like to use named breakpoints when I'm doing a little breakpoint two-step like this, otherwise you have to use the ID of the first breakpoint, and that can change from run to run depending on the order in which you set breakpoints.
I also made breakpoint B a one-shot since you're just using it to freeze the hit-count of A so it only needs to get hit the once. If it's more convenient you could also make B auto continue and then just read out the hit count of A when the program exits.
If you wanted to get fancier, you could use a Python callback for B instead, and get the hit count from A and report that however you want. It's more work but it is easier to control output formatting from Python...