A quantum system can behave as a wave or as a particle, depending on the experimental arrangement. When, for example, measuring a photon using a Mach-Zehnder interferometer, the photon acts as a wave if the second beam splitter is inserted, but as a particle if this beam splitter is omitted. The decision of whether or not to insert this beam splitter can be made after the photon has entered the interferometer, as in Wheeler's famous delayed-choice thought experiment. In recent quantum versions of this experiment, this decision is controlled by a quantum ancilla, while the beam splitter is itself still a classical object. Here, we propose and realize a variant of the quantum delayed-choice experiment. We configure a superconducting quantum circuit as a Ramsey interferometer, where the element that acts as the first beam splitter can be put in a quantum superposition of its active and inactive states, as verified by the negative values of its Wigner function. We show that this enables the wave and particle aspects of the system to be observed with a single setup, without involving an ancilla that is not itself a part of the interferometer. We also study the transition of this quantum beam splitter from a quantum to a classical object due to decoherence, as observed by monitoring the interferometer output. The wave-particle duality is one of the fundamental mysteries that lie at the heart of quantum mechanics. However, these two incompatible aspects cannot be observed simultaneously, as captured by Bohr's principle of complementarity [1-5]: Particlelike versus wavelike outcomes are selected by experimental arrangements that are mutually exclusive. This is well illustrated by the Mach-Zehnder interferometer, as shown in Fig. 1(a). Split by the first beam splitter (BS 1 ), a photon travels along two paths, 0 and 1. The relative phase θ between the quantum states associated with these paths is tunable. In the presence of the second beam splitter (BS 2 ), the two paths are recombined and the probability for detecting the photon in the detector D 0 or D 1 is a sinusoidal function of θ exhibiting wavelike interference fringes. On the other hand, in the absence of BS 2 , the experiment reveals which path the photon followed, and the photon is detected in one or the other detector with equal probability 1=2, thus behaving as a particle.One can argue that the behavior of the photon is predetermined by the experimental arrangement, where the presence or absence of the second beam splitter affects the photon prior to its entering the interferometer. The possibility of such a causal link is precluded in Wheeler's delayed-choice experiment [6][7][8], in which the observer randomly chooses whether to insert BS 2 , and thus whether to perform an interference or a which-path experiment, after the photon has passed through BS 1 . Therefore, the photon could not "know" in advance which behavior it should exhibit. Wheeler's delayed-choice experiment has been demonstrated previously [9][10][11][12][13], where the spacelike separation ...