This is a simplified answer:
If a capacitor is charged to a given level, it 'holds' an amount of energy that is POTENTIAL energy. That energy becomes KINETIC during the discharge phase. Assuming that the second capacitor has the SAME electrical characteristics as the first, i.e., capacitance, ESR, working voltage, etc., then the only additional external component(s) that essentially come into play are the resistance of the conductors and the connections, i.e., wiring, etc. between the two capacitors. Using your example, what will happen is the following:
The first capacitor will discharge into the second capacitor at a rate determined by the time constant established by the capacitance of the circuit and the circuit (including the capacitors themselves) resistance and some capacitive reactance (we will ignore inductive reactance, although there will be some amount). If the first capacitor is charged to Vx, then the second capacitor will attempt to charge to the same level. However, there will be losses in the circuit due to resistance, etc. The second capacitor can only charge based on the current supplied by the first capacitor which is decreasing at the time constant rate established above. The charge curves for the two capacitors will be the inverse of each other. The total energy supplied to the first capacitor will be evenly distributed (minus the losses) between the two capacitors. The only energy 'lost' is that which is lost due to resistance heating, etc., based on the parameters of the given circuit. An analogy can be drawn with two buckets - - one empty and one full of water. The two buckets are at the same level and a tube is connected at the bottom of each bucket. When the water begins to flow, it will eventually reach a point where the levels are essentially the same. You might ask why can't I just move all of the water from the full bucket to the empty bucket? To draw a correlation to the capacitor circuit - that implies that the first capacitor's potential energy (e.g., the height of the full bucket) is greater than what it is at rest and fully charged. In other words, that is why you can completely move all of the charge from the one capacitor to the other without any external influence - - just the circuit you described.
Hope this helps.
I hope this helps.