The question says that the OP "asked" company A for confidentially. It does not say that the agreed to it. If they did not, the asker has no case, and they could publicly admit having used his idea and s/he still would have no case.
If Company A agreed to confidentiality, and did so in writing (or if the agreement can be otherwise proved) then there might be a case. Proving communication of the idea to Company B would indeed be a hard part of bringing the case. Company B could also defend by showing independent invention of the concept. History has many examples of the same idea being independently arrived at by multiple people at about the same time. Ideas are more common, and therefore of less value standing alone, than many inventors think.
To seriously pursue such a case, it would be a very good idea to consult a lawyer experienced in IP law in your jurisdiction. NDAs (and this agreement, if it existed, would be a form of NDA, even if it wasn't called that) are often governed by state law, but trade secret law is partly Federal (see 18 U.S.C. § 1832). A lawyer could advise more specifically and accurately on the chances of success, the probable costs, and the possible amount of recovery, based on the specific facts. But as described, the case is far from a sure thing.
More specifically, most US states have enacted some version of the Uniform Trade Secrets Act. The USTA sec 1.2 prohibits using or sharing a trade secret gained through "improper means". Section 1.1 defines this:
"Improper means" includes theft, bribery, misrepresentation, breach or inducement of a breach of a duty to maintain secrecy, or espionage through electronic or other means.
Promising to observe confidentiality and then breaking that promise would seem to fit.
Section 1.4 defines a "trade secret" as:
"Trade secret" means information, including a formula, pattern, compilation, program, device, method, technique, or process, that:
(i) derives independent economic value, actual or potential, from not being generally known to, and not being readily ascertainable by proper means by, other persons who can obtain economic value from its disclosure or use, and
(ii) is the subject of efforts that are reasonable under the circumstances to maintain its secrecy
The idea described in the question might fit this definition.
The UTSA provides successful plaintiffs with several possible forms of relief, including injunctive relief, damages, and attorney's fees. The details will be decided by the court in each case.