A can reasonably demonstrate this without showing the source code, by showing their change control history (without the differences for each file, of course). Other documentation such as design documents and review records would also help. The aim is to show that a development process took place, starting from nothing, and developing iteratively until they ended up with what they have today.
Since B's code is GPL and hence publicly accessible, A must also have a quality process document describing their Chinese wall process to ensure A (or A's team) did not refer to B's code during the process.
If A does not have an appropriate quality process, and A's code "magically" appeared in their version control system overnight with no further documentation, A will have a great deal of trouble proving that they did not violate B's copyright.
Conversely of course, B does have to have a credible case to put to the court. Common ways for B to prove this would be by checking for common function and variable names within the object files, and checking for common text strings within the object files or executable. And during disclosure, of course any lack of documentary evidence for independent development would be considered too.
The important feature of any copyright case though is that it is a civil case. As such, there is no such thing as "innocent until proven guilty". The judge is expected to rule based on the balance of probabilities, and it is as much for A to disprove the allegation as it is for B to prove it.